I just create a Solution that contains 3 projects.
Order by build order
-
Silverlight Application that is included in /ClientBin of ASP.NET Web Application project
-
Windows Form Application that is used to optimize all xap in /ClientBin when Visual Studio pass build (post-build event).
-
ASP.NET Web Application that display Silverlight application in /ClientBin
When I build ASP.NET web application successfully, ClientBin directory in web application project contain 3 Xap Files. After that VS.net fire a post-build command event that executes the Windows Form application. Windows form optimize all Xap and remote 2 Xap Files from 3 Xap Files.
Finally, Vs.net copy 3 Xap files from Silverlight application project to ClientBin directory again. Why? I can’t find any log about copy Xap files after post-build event (by using MSBuild project build output verbosity: Diagnostic)
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".
Update
I updated the build order by building the Windows Forms application. After build web application. Next, I use the Windows Dorm application post-build event to execute its EXE. Everything works fine. But I don’t like this solution because It’s very strange solution for me.
I’m assuming that the projects reference each other? So:
Visual Studio will automatically copy dependant files into the project hierarchy unless you tell it not to. so the steps Visual Studio will take are:
Basically, most of the dependant moves happen before the post build events:
Then the build and AfterBuild events happen.
My guess is that VS is noticing the output of the SilverLight app is different to the version it has under it, and so goes and fetches a new copy.