我有一個使用系統授權用戶的項目。雖然我做了一些更新,但我希望能夠將IsAdmin(用戶名)設置爲始終返回true。我不會忘記刪除它,但是如果在Visual Studio中有功能,比如// TODO,它會創建一個警告或者構建或發佈,這將會很有幫助。有沒有人知道這樣的功能?在VS 2008中構建項目(但更重要的是發佈)時是否有創建警告的方法?
感謝
我有一個使用系統授權用戶的項目。雖然我做了一些更新,但我希望能夠將IsAdmin(用戶名)設置爲始終返回true。我不會忘記刪除它,但是如果在Visual Studio中有功能,比如// TODO,它會創建一個警告或者構建或發佈,這將會很有幫助。有沒有人知道這樣的功能?在VS 2008中構建項目(但更重要的是發佈)時是否有創建警告的方法?
感謝
你的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構建一個錯誤。
我不知道我抓住你想要做什麼,而是你可能不得不使用preprocessor directive S(如#warning後),也許將它們結合起來?像
#if DEBUG
#warning This is debug!
#endif
這是想法謝謝。我不知道#警告是否存在,但我只是想要一些能夠在構建時引發提示的能力。 – Kennifer 2010-10-01 14:54:12