2017-05-23 23 views
0

我的項目在本地和生產中有不同的行爲。 我的結論是,我的.vbproj中的某些任務不會在本地執行,也不會在DEBUG或RELEASE模式下執行。例如,我在一個元素中有一個消息,並且它在構建之後不會出現在OUTPUT窗口中。爲什麼Visual Studio Build不在具有自定義名稱的目標元素中輸出消息?

我的結論錯了嗎?我在這裏錯過了什麼嗎?在控制檯

<Target Name="test12345"> 
<Message Text="This is a test message" Importance="high" /> 
</Target> 

顯示消息:

不在控制檯顯示的消息

<Target Name="AfterBuild"> 
<Message Text="This is a test message" Importance="high" /> 
</Target> 

回答

0

AfterBuild名稱使得項目建成後,它自動運行(以具體而言,AfterBuild已經定義,但意味着在自定義項目中被覆蓋)。

當您使用自定義名稱定義目標時,您還需要將其綁定到構建中,例如,通過使用AfterTargets

<Target Name="test12345" AfterTargets="Build"> 
<Message Text="This is a test message" Importance="high" /> 
</Target> 
相關問題