代码之家  ›  专栏  ›  技术社区  ›  Martin

在VS2008中构建(但更重要的是发布)项目时,是否有创建警告的方法?

  •  1
  • Martin  · 技术社区  · 15 年前

    谢谢

    2 回复  |  直到 15 年前
        1
  •  1
  •   heavyd    15 年前

    你的C和VB(和VS 2010中的C++)项目文件是 MsBuild

    <!-- These two targets exist at the bottom of all .csproj/.vbproj files, 
         but are usually empty. -->
    <Target Name="BeforeBuild">
      <Warning
        Text="This is a debug build!."
        Condition="'$(Configuration)' == 'Debug'" />
    </Target>
    <Target Name="AfterBuild">
    </Target>
    

    您还可以使其成为一个错误,从而停止使用 Error task

        2
  •  0
  •   Philippe    15 年前

    我不确定我是否掌握了你想做的事,但你可能不得不使用 preprocessor directive s(例如#警告),并可能合并它们?像这样的

    #if DEBUG
    #warning This is debug!
    #endif