There are a number of questions here on SO about how to publish ASP.NET web site from command-line (including my own here), but none of them get me to the solution I want:
- Single output folder as I specified
- Applied Web.config transformations
I'm getting close to something that works for me, but there are still a couple of issues.
Here is what I have so far:
SET TEMP_PATH=c:\_MyProject\
SET DEST_PATH=%TEMP_PATH%_Output\
SET CSPROJ_PATH=.\MyProject\MyProject.csproj
SET CONFIGURATION=Release
SET LOG_FILE=MyProjectDeploy.log
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ^
%CSPROJ_PATH% ^
/p:Configuration=%CONFIGURATION%;DeployOnBuild=True;PackageAsSingleFile=False;AutoParameterizationWebConfigConnectionStrings=False ^
/property:OutDir=%TEMP_PATH% ^
/property:WebProjectOutputDir=%DEST_PATH% ^
/l:FileLogger,Microsoft.Build.Engine;logfile=%LOG_FILE%
But my script still has these problems:
- The version with one Web.config with applied transformation is deep inside folder structure:
C:\_MyProject\_PublishedWebsites\MyProject_Package\Archive\Content\C_C\<Long path that replicate my folder structure>\obj\Release\Package\PackageTemp\
The problem that path to the probject is included here, so it cat vary from developer to developer. - The version which is located in
%DEST_PATH%
is what I need but without Web.config transformations