-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssemblyInfo generation skipped on incremental build even if Version/VersionSuffix changes #967
Comments
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. |
I think you're thinking in the right direction, though there's no easy way to deal with property changes from the command line in MSBuild in general. We added some things for MSBuild 15 that could probably be assembled in a reasonable way, mostly in dotnet/msbuild#1328. |
Some context: this is nasty when building twice per CI build (one "CI drop" with a suffix and one "potentially releasable" package without suffix so a chained release definition might publish the suffix-less build). Sadly, I'm wondering if |
String.GetHashCode is not good enough, https://msdn.microsoft.com/en-us/library/jj152924(v=vs.110).aspx is on by default in CoreCLR. In general, an incremental build with different properties is risky, every target is potentially vulnerable to bugs like this. We should fix this, but I would still caution against a CI setup as described where RTM packages (and only RTM packages!) are shipped from incremental builds. |
Silly me. I've had some success prototyping the hash approach by creating a If that is the way forward, I'd be happy to contribute it in a proper PR. Just have the following design questions:
|
Went a different route using msbuild's builtin |
@nguerrera @dsplaisted any concerns with @dasMulli suggest approach? I would love to have a PR for this if possible. This has come up quite a few times. |
@livarcocc I've already opened a PR (#1007) but it looks like some discussion is still needed. |
Having dotnet/msbuild#1949 would probably also help quite a few users. |
Fixed by #1255 |
* Update dependencies from https://github.com/dotnet/arcade build 20190918.2 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19468.2 * Update dependencies from https://github.com/dotnet/arcade build 20190919.4 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19469.4 * Update dependencies from https://github.com/dotnet/arcade build 20190919.8 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19469.8 * Update dependencies from https://github.com/dotnet/arcade build 20190920.9 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19470.9 * Update dependencies from https://github.com/dotnet/arcade build 20190923.5 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19473.5 * Switch to embedded package icon
Steps to reproduce:
dotnet new lib
dotnet restore
dotnet build
dotnet build /p:VersionSuffix=alpha
dotnet publish /p:Version=1.2.3
dotnet 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:
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:
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 outputtmp.1.0.0-beta.AssemblyInfo.cs
is missing and run the target?The text was updated successfully, but these errors were encountered: