AssemblyInfo generation skipped on incremental build even if Version/VersionSuffix changes
See original GitHub issueSteps to reproduce:
dotnet new libdotnet restoredotnet builddotnet build /p:VersionSuffix=alphadotnet publish /p:Version=1.2.3dotnet pack /p:VersionSuffix=beta
Expected behaviour:
The bin/Debug/netstandard1.4/tmp.AssemblyInfo.cs should be updated on every subsequent build/publish/pack command and the resulting assembly shall contain the requested attributes.
Actual behaviour:
detailed log contains:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
The assembly info is generated only once and only contains 1.0.0 / 1.0.0.0 versions. All published dlls contain this version (even the assembly contained in the npkg - the package is versioned correctly).
System:
C:\Users\martin.ullrich\Documents\tmp>dotnet --info
.NET Command Line Tools (1.0.0)
Product Information:
Version: 1.0.0
Commit SHA-1 hash: e53429feb4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0
Rationale
Since the inputs of CoreGenerateAssemblyInfo is limited to $(MSBuildAllProjects) it is skipped on incremental build when only the command line arguments change.
Maybe the file name can be changed to include the Version property so msbuild will see that the output tmp.1.0.0-beta.AssemblyInfo.cs is missing and run the target?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Can I automatically increment the file build version when ...
In visual Studio 2008, the following works. Find the AssemblyInfo.cs file and find these 2 lines: [assembly: AssemblyVersion("1.0.0.0")] ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hmm, this is tricky because there are other properties that impact the file. I think a complete solution would involve hashing all of those properties and putting it in file name or something.
cc @rainersigwald
Fixed by #1255