【问题标题】:How to override vbproj DebugSymbols with msbuild?如何用 msbuild 覆盖 vbproj DebugSymbols?
【发布时间】:2009-07-24 20:28:21
【问题描述】:

无论我想要生成 .pdb 文件的各种 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 /t:Build /v:Minimal /nologo "/p:OutputPath=%~dp0bin;Configuration=Release" /fl /flp:LogFile=FX.log;Verbosity=Normal FX.proj

我想覆盖每个 vbproj 中的 DebugSymbols 属性。

我尝试将它添加到命令行中,如下所示:

msbuild /t:Build /v:Minimal /nologo "/p:OutputPath=%~dp0bin;Configuration=Release;DebugSymbols=true" /fl /flp:LogFile=FX.log;Verbosity=Normal FX.proj

与 MSBuild 目标属性类似:

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

但似乎两者都不起作用。在 vbproj 中为指定配置设置的任何内容都会发生。

有什么想法吗?

【问题讨论】:

    标签: msbuild


    【解决方案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 重命名为其他名称,也许是 ProjectsProjectReference 具有特定含义,因此可能会造成混淆。

    赛义德·易卜拉欣·哈希米

    我的书:Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多