Introduction
I am looking for the "run when VS loads the project" extension point. This should also be included in the assembly outside of VS. This means that it should end with msbuild scripts.
MSBuild InitialTargets
Now I find that MSBuild offers an extension point to fulfill the goal before doing any other: <Project InitialTargets="..."/> . This fits perfectly with my need for a console / build server. However, with Visual Studio, I would prefer it if it were (optional) when VS loads the solution. So I checked if this is so: Yes and No. When I import the following project into my *.csproj :
<Target Name="TestOnStart"> <Warning Text="Hey $(MSBuildProjectName) is being initialised"/> </Target>
After loading the solution into VS, a warning appears for some projects, but not for all.
Questions
- How can I get VS to execute
InitialTargets on every boot?
Or maybe you can help me answer this question by letting me find a solution on my own :-):
- How does VS determine whether to run the build or run
InitialTargets when the project loads?- How can I influence this?
Thanks:)
Adding
I just noticed that if I change one of the csproj project project files from outside, VS will ask me if I want to reload the project. If I choose "reload all projects", it will execute the InitialTargets all projects. Therefore, perhaps this should do something with caching or the like. Thus, solving my problem can lead to VS believing that something in the project has changed (after / before loading the solution).
visual-studio visual-studio-2013 msbuild
BatteryBackupUnit
source share