我只是创建一个包含3个项目的解决方案。
按构建顺序排序
Silverlight应用程序
Windows窗体应用程序,用于在Visual Studio传递构建(构建后事件)时优化/ ClientBin中的所有xap。
ASP.NET Web应用程序
当我成功构建ASP.NET Web应用程序时,Web应用程序项目中的ClientBin目录包含3个Xap文件。之后VS.net
触发执行Windows窗体应用程序的构建后命令事件。 Windows窗体优化来自3个Xap文件的所有Xap和远程2个Xap文件。
最后,Vs.net再次将Silverlight应用程序项目中的3个Xap文件复制到ClientBin目录。为什么?我在后期构建事件后找不到任何关于复制Xap文件的日志(通过使用MSBuild项目构建输出详细程度:诊断)
Target "PostBuildEvent" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Task "Exec"
Command:
**T:\myProject\Higgs\Higgs\Higgs.Utils.WinApp\bin\Higgs.Utils.WinApp.exe mode=OptimizeXap clientbindir=T:\myProject\Higgs\Higgs\Higgs.Web.UI\ClientBin\ mainxapfilename=Higgs.Silverlight.UI**
Done executing task "Exec".
Done building target "PostBuildEvent" in project "Higgs.Web.UI.csproj".
Target "CoreBuild" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Task "CallTarget" skipped, due to false condition; ('$(UnloadProjectsOnCompletion)'=='true') was evaluated as ('false'=='true').
Task "CallTarget" skipped, due to false condition; ('$(UnloadProjectsOnCompletion)'=='true') was evaluated as ('false'=='true').
Task "CallTarget" skipped, due to false condition; ('$(UnloadProjectsOnCompletion)'=='true') was evaluated as ('false'=='true').
Done building target "CoreBuild" in project "Higgs.Web.UI.csproj".
Target "AfterBuild" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Done building target "AfterBuild" in project "Higgs.Web.UI.csproj".
Target "Build" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Building target "Build" completely.
No input files were specified.
Done building target "Build" in project "Higgs.Web.UI.csproj".
Target "AfterRebuild" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Done building target "AfterRebuild" in project "Higgs.Web.UI.csproj".
Target "Rebuild" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Building target "Rebuild" completely.
No input files were specified.
Done building target "Rebuild" in project "Higgs.Web.UI.csproj".
Done building project "Higgs.Web.UI.csproj".
更新
我通过构建Windows窗体应用程序更新了构建顺序。构建Web应用程序后。接下来,我使用Windows Dorm应用程序生成后事件来执行其EXE。一切正常。但我不喜欢这个解决方案,因为对我来说这是一个非常奇怪的解决方案。
答案 0 :(得分:0)
这并不能完全解决您的问题,但是FYI PostBuildEvent似乎是构建过程的最后一步;您可以通过检查了解有关订购的更多信息
C:\的Windows \ Microsoft.NET \框架\ V2.0.50727 \ Microsoft.Common.targets
显示了msbuild逻辑。
答案 1 :(得分:0)
我不知道你究竟是什么问题,但是如果对你的项目有任何依赖,你应该命令它们正确构建。
答案 2 :(得分:0)
我假设这些项目相互引用?所以:
Visual Studio会自动将相关文件复制到项目层次结构中,除非您不告诉它。所以Visual Studio将采取的步骤是:
基本上,大多数依赖移动在构建后事件之前发生:
Task "FindUnderPath"
Comparison path is "D:\Projects\PublicSites\WebTest".
Path [...]
[...]
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "bin\".
Path [...]
[...]
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "obj\Debug\".
Path [...]
[...]
Done executing task "FindUnderPath".
Task "RemoveDuplicates"
Done executing task "RemoveDuplicates".
Done building target "_CleanGetCurrentAndPriorFileWrites" in project
"WebTest.csproj".
Target "IncrementalClean" in file
"c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
Task "FindUnderPath"
Comparison path is "bin\".
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "obj\Debug\".
Done executing task "FindUnderPath".
Task "Delete"
Done executing task "Delete".
Task "RemoveDuplicates"
Done executing task "RemoveDuplicates".
Task "WriteLinesToFile"
Done executing task "WriteLinesToFile".
Done building target "IncrementalClean" in project
"WebTest.csproj".
然后发生构建和AfterBuild事件。
我的猜测是VS注意到SilverLight应用程序的输出与它下面的版本不同,所以也可以获取新副本。