Monday, November 16, 2009

Using DOS Batch commands to create release folder with DateTime

In my current endeavor I have a solution that contains 3 setup projects that each has a distinct purpose within the overall scheme of things. When I build the solution I'd like to be able to have all 3 setup projects' output all grouped together in one folder whose name reflects the unique datetime (to the second). That way I can uniquely identify at a later date the releases that get built. Here's how I do it with a DOS batch file.

for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE1=%%D%%B%%C
for /F "tokens=1-4 delims=:., " %%a in ('time/T') do set TIME1=%%c%%a%%b
set "dt1=%DATE1:~0,8%%TIME1:~0,1%%TIME1:~2,4%"
set releasedir=MySoftware_%dt1%_Release
z:
cd \All_Customer_Releases
md %releasedir%
cd %releasedir%
md Build1
cd Build1
c:
cd "C:\Documents and Settings\alex\My Documents\Visual Studio 2008\Projects\SolutionRoot"
cd "Setup1\Debug"
copy *.* z:
z:
cd ..
md Build2
cd Build2
c:
cd ..\..
cd "Setup2\Debug"
copy *.* z:
z:
cd ..
md Build3
cd Build3
c:
cd ..\..
cd "Setup3\Debug"
copy *.* z:


Please note that I changed the solution name and the names of the 3 projects to protect my customer's privacy.

I also include this batch file in the root folder of the solution where the .sln file is located. That way its tracked like all the rest of my source files in TFS Version Control.

Wednesday, November 11, 2009

WSDL to ASMX

Today I got 2 WSDL files from 2 different vendors who will be calling our web services to do delegated authentication for single sign on. Here's a todo list on what needs to be done to go from WSDL file to having web services that can be used by the 3rd party application as desired.

1. Use wsdl.exe to generate the .cs files.

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\wsdl.exe" "C:\MyWSDLs\third_party.wsdl" /out:"C:\MyCSs" /serverInterface

2. Create an ASP.Net website with 2 new ASMX files for these vendors with codebehinds.

3. Copy the generated .cs files' code (i.e. the ones in the C:\MyCSs directory) into the ASMX codebehind files.