简体   繁体   中英

Update assembly version in MS Build only if code changed

I am new to MSBuild. I am wrote inline script where I am able to increase assembly version. I am successfully able to update assemblyinfo.cs file

This task will every time increase assembly version even without code change. Is there any way to check in MSBuild script not to increase assembly version in assemblyinfo.cs file if there is no code change.

In my Visual studio solution there are multiple project, so I needs to only update those project's dll on which some code changed.

I am able solve the above question by following code

Basically we need to override target, this targets get called by MSBuild when there is any code change is detected (basically MSBuild will detect based on changed date timestamp of assembly)

BeforeCompile

You can go through the list of inbuilt property and item-group which Microsoft provides.

List of inbuilt property and itemgroup

<Target Name="BeforeCompile"
      Inputs="@(Compile);
        @(ReferencePath);
        $(MSBuildAllProjects);"
      Outputs="@(IntermediateAssembly)">

  ***** ADD YOUR CUSTOM CODE HERE ****

</Target>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM