I'm looking to create a msbuild custom task that will control 开发者_开发知识库how the assembly version is generated on a build.
The first problem that I'm facing is that I don't want to change the assembly version if the project has not changed.
Because changing the assembly version will make a change to the project, and because the project will be modified (by me), it will cause the project to be built. The project would not be built if my task did not run.
Is there a way in msbuild to get my task to run before compilation and to know if the project will actually be built or to know that the project has not changed.
Thanks
It depends on how you want to add version, your build system works and so on.
If you have one version for all assemblies in product you can create simple task with condition whether svn/git/.. revision changed. And then add +1 to all AssemblyInfo.cs files.
The same solution you can apply on per project base.
Real conditions that is used to decide compile or not are too complex.
精彩评论