2009-07-24 47 views
1

無論我想要生成.pdb文件的各種vbproj文件中的DebugSymbols設置如何。如何用msbuild覆蓋vbproj DebugSymbols?

我有一個名爲FX.proj一個MSBuild項目,看起來像這樣:

<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> 

我把它從這樣的命令行:

的MSBuild /噸:編譯/ V:最小/ NOLOGO 「/ p:OutputPath =%〜dp0bin;配置=推出」/ FL /flp:LogFile=FX.log;Verbosity=Normal FX.proj

欲覆蓋在每個vbproj的DebugSymbols屬性。

我試圖將其添加到命令行是這樣的:

的msbuild /噸:構建/ V:最小/ NOLOGO「/ P:OutputPath =%〜dp0bin;配置=推出; DebugSymbols =真正的」/FL /flp:LogFile=FX.log;Verbosity=Normal FX.proj

和像這樣的目標的MSBuild屬性:

<Target Name="Build"> 
    <MSBuild Projects="@(ProjectReferences)" Targets="Build" Properties="DebugSymbols=true" /> 
</Target> 

但既不似乎工作。無論在指定配置的vbproj中設置什麼,都會發生什麼。

任何想法?

回答

1

我只是做這個確切的事情,並插入目標

<Target Name="AfterBuild"> 
    <Message Text="DebugSymbols: $(DebugSymbols)" Importance="high" /> 
    </Target> 

到每一個.vbproj文件(import語句後)。這是我的整個FX.proj文件。

<?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> 

您可以在http://www.sedodream.com/Content/binary/DebSymbols.zip下載我的文件。順便說一句,您可能會考慮將項目從ProjectReference重命名爲其他項目,也許項目ProjectReference具有特定的含義,因此可能會造成混淆。

賽義德·易卜拉欣·哈希米

的My Book:Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build