Answered by:
Release builds

Question
-
Hi
I have a bunch of C# solutions that have to be build together. For that purpose I have made a custom msbuild project file looking shown below (very much scaled down version).
It works fine - but only for debug builds. No matter what I do it always builds the debug configuration (have tried with Any CPU, AnyCPU, Release|Any CPU, etc..). To me it appears as passing a .sln to the msbuild task always default to a debug build. There is no problems in running "devenv.exe /build release ...."
Help will be greatly appreciated
Lars
<ItemGroup> <ProjectToBuild Include="DHI.Solutions.Core.sln"> <Properties>NoWarn=1607</Properties> </ProjectToBuild> <!..... --> </ItemGroup> <Target Name="Build"> <MSBuild Projects="@(ProjectToBuild)" Properties="Configuration=Release;Platform=Any CPU" Targets="Build"/> </Target>
Tuesday, November 9, 2010 7:32 AM
Answers
-
I would image that it has to do with building using devenv instead of msbuild. You could try 'msbuild *.sln /p:Configuration=Release' and see if that gives you the release bits. The behavior of build properties is 'last one wins'. It could be that the IDE has the default set to debug and that's overriding your property setting. Let me know if msbuild works for you.
Mark Howell Display Advertising Platform- Proposed as answer by Victor_Chen Tuesday, November 16, 2010 7:25 AM
- Marked as answer by Victor_Chen Wednesday, November 17, 2010 2:19 AM
Tuesday, November 9, 2010 7:01 PM
All replies
-
I would image that it has to do with building using devenv instead of msbuild. You could try 'msbuild *.sln /p:Configuration=Release' and see if that gives you the release bits. The behavior of build properties is 'last one wins'. It could be that the IDE has the default set to debug and that's overriding your property setting. Let me know if msbuild works for you.
Mark Howell Display Advertising Platform- Proposed as answer by Victor_Chen Tuesday, November 16, 2010 7:25 AM
- Marked as answer by Victor_Chen Wednesday, November 17, 2010 2:19 AM
Tuesday, November 9, 2010 7:01 PM -
Hi Mark
Yes, that works; but then I basically have to use the "Exec" task instead of the "Msbuild" task inside my custom msbuild project file - which might or might not be a problem. I parse the output from the builds in order to build a couple of overview HTML tables (what have failed and what have not failed).
You say "has to do with building using devenv instead of msbuild" - but the case is that just using devenv.exe from a command line builds correctly while the msbuild task in my custom build project file does not. My reference to devenv.exe was just to assert that the solution file does not have errors.
To me it appears as the 'Properties="Configuration=Release"' instruction in the msbuild task is either ignored by the msbuild task or it is getting passed as a project configuration and not as a solution configuration instruction.
But thanks for your answer
Best regards
Lars
Wednesday, November 10, 2010 1:14 AM -
Thanks for your post.
As Mark said, some build properties might be overrided.
Is it resolved?
Best Regards,
Ziwei Chen
Tuesday, November 16, 2010 7:28 AM