TL;博士
我是否可以有一个 Visual Studio 预构建事件来跳过项目的构建而不会出现视觉错误?
细节
pre-build
我有一个项目,其中包含一个自定义 XML 文件和一个在事件期间从 XML 生成资源文件的 Powershell 脚本。
我的目标是仅在 XML 文件发生更改时才构建项目。我已经可以确定文件是否已更改,但我无法通知 Visual Studio 跳过构建。0
要么我用退出代码(让构建继续)或任何其他数字(在错误列表中显示一个丑陋的错误)停止脚本。
我可以有一个pre-build
脚本来决定是构建还是跳过项目?
例子
# Check to see if the current file is different from the file copied during build.
if((Test-Path $buildXmlFile) -and (Compare-Object -ReferenceObject (Get-Content $projectXmlFile) -DifferenceObject (Get-Content $buildXmlFile))){
Write-Host "Changes found! Rebuilding!"
} else {
Write-Host "No changes found! Skipping Build"
# Exit 0 will cause it to still build...
# Exit -1, Exit 1, etc. will cause a big error to show...
# HOW DO I SKIP???
}