2010-10-01 30 views

回答

1

你的C#和VB(和C++在VS 2010中)的項目文件的東西是MsBuild文件,並使用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構建一個錯誤。

0

我不知道我抓住你想要做什麼,而是你可能不得不使用preprocessor directive S(如#warning後),也許將它們結合起來?像

#if DEBUG 
#warning This is debug! 
#endif 
+0

這是想法謝謝。我不知道#警告是否存在,但我只是想要一些能夠在構建時引發提示的能力。 – Kennifer 2010-10-01 14:54:12

相關問題