Ok, I figured this out after I asked about this blog, http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx
In step 4, it shows the arg command line that I have not seen before, / T: TransformWebConfig
Unfortunately, this alone does not solve the problem. It does the conversion, but the conversion is in obj / Release / TransformWebConfig / transform / Web.config (obj / Release or obj / Debug or obj / YourTranformName).
So, to finally get a decent solution, this is what I had to do.
<exec program="${exec.msbuild}" failonerror="true"> <arg value="${path.sourceCode}/ProjectFolder/Project.csproj" /> <arg value="/p:Configuration=Release" /> <arg value="/t:ResolveReferences" /> <arg value="/t:_CopyWebApplication" /> <arg value="/t:TransformWebConfig" /> <arg value="/p:OutDir=${path.buildFromProject}/temp/" /> <arg value="/p:WebProjectOutputDir=${path.buildFromProject}/ProjectBuild/" /> </exec> <delete dir="${path.build}/temp" failonerror="true"/> <delete file="${path.build}/ProjectBuild/Web.config" failonerror="true"/> <delete file="${path.build}/ProjectBuild/Web.Debug.config" failonerror="true"/> <delete file="${path.build}/ProjectBuild/Web.Release.config" failonerror="true"/> <copy file="${path.sourceCode}/ProjectFolder/obj/Release/TransformWebConfig/transformed/Web.config" tofile="${path.build}/ProjectBuild/Web.config" />
Note that OutDir is different from WebProjectOutputDir. That's why:
- OutDir gives you everything in the project "solution."
- WebProjectOutputDir gives you a bare minimum for a web project project (i.e. not the whole solution).
Of the other projects in the solution using OutDir, a lot of additional baggage appeared that we do not need, so we just sent OutDir to a temporary folder and deleted it, as you can see in the above steps. By the way, OutDir is absolutely necessary. The assembly will not work if you remove it. WebProjectOutputDir seems to work outside of OutDir.
There is only one minor flaw in this entire setup. The bin library is missing many pdb files. The only pdb copied was that of a web project.
If anyone finds a one-step solution with MSBuild, submit it: P Although this is a good solution, it is still only 99.9999% perfect and very similar to the ones listed above. I am sure that there will be some small nuance or missing step.
source share