Reputation: 23
Regardless of the DebugSymbols setting in my various vbproj files I want to generate .pdb files.
I have a msbuild project named FX.proj that looks like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReferences Include="C:\product\forms.vbproj" />
<ProjectReferences Include="C:\product\core.vbproj" />
<ProjectReferences Include="C:\product\fx.vbproj" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(ProjectReferences)" Targets="Build" />
</Target>
</Project>
I call it from the command line like this:
msbuild /t:Build /v:Minimal /nologo "/p:OutputPath=%~dp0bin;Configuration=Release" /fl /flp:LogFile=FX.log;Verbosity=Normal FX.proj
I want to override the DebugSymbols property in each vbproj.
I have attempted to add it to the command line like this:
msbuild /t:Build /v:Minimal /nologo "/p:OutputPath=%~dp0bin;Configuration=Release;DebugSymbols=true" /fl /flp:LogFile=FX.log;Verbosity=Normal FX.proj
AND to the MSBuild target Properties like this:
<Target Name="Build">
<MSBuild Projects="@(ProjectReferences)" Targets="Build" Properties="DebugSymbols=true" />
</Target>
but neither seems to work. Whatever is set in the vbproj for the specified Configuration is what happens.
Any ideas?
Upvotes: 1
Views: 1300
Reputation: 44342
I just did this exact thing, and inserted the target
<Target Name="AfterBuild">
<Message Text="DebugSymbols: $(DebugSymbols)" Importance="high" />
</Target>
Into every .vbproj file (after the import statement). Here is my entire FX.proj file.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReferences Include="WindowsApplication1\WindowsApplication1.vbproj"/>
<ProjectReferences Include="ClassLibrary1\ClassLibrary1.vbproj"/>
<ProjectReferences Include="ClassLibrary2\ClassLibrary2.vbproj"/>
</ItemGroup>
<Target Name="Build">
<Message Text="Building for DebugSymbols=false" Importance="high"/>
<MSBuild Projects="@(ProjectReferences)"
Properties="DebugSymbols=false"/>
<Message Text="Building for DebugSymbols=true" Importance="high"/>
<MSBuild Projects="@(ProjectReferences)"
Properties="DebugSymbols=true"/>
</Target>
</Project>
You can download my files at http://www.sedodream.com/Content/binary/DebSymbols.zip. BTW you may want to consider renaming the item from ProjectReference to something else, maybe Projects. ProjectReference has a specific meaning so it may be confusing.
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
Upvotes: 1