-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Set assembly versions by MSBuild #3917
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
Conversation
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <DelaySign>true</DelaySign> | ||
| <Description>PowerShell Core's Microsoft.Management.Infrastructure.CimCmdlets project</Description> | ||
| <NoWarn>$(NoWarn);CS1570;CS1572;CS1573;CS1574;CS1584;CS1587;CS1591</NoWarn> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did all of these come from? We need to document the justification for all warnings that we ignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised, too. We do not receive these warnings with the original csproj files, but they appear after we add "*.props".
I guess this is a "feature" of Sdk="Microsoft.NET.Sdk" templates.
I believe that some of these warnings can be easily corrected in separate PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the warnings - all belong to XML comments and we have TONs warnings - It takes a lot of work to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with disabling the xml doc warnings.
| <AssemblyName>Microsoft.Management.Infrastructure.CimCmdlets</AssemblyName> | ||
| <AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk</AssemblyOriginatorKeyFile> | ||
| <SignAssembly>true</SignAssembly> | ||
| <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the GenerateAssembly* entries are missing. I'm assuming it was intentional. Can you please explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>" ?
We explicitly had AssemblyInfo attrubutes in AssemblyInfo.cs files and we had to disable auto generating its by "<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>".
Now we use auto generating and should remove the "false".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment applied to all of those flags as well since I referred to them as "GenerateAssembly*". I am not particularly familiar with them and would like to make sure that we are not inadvertently dropping a flag that is necessary for PowerShell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these attributes were statically installed in the AssemblyInfo.cs files and that their automatic generation was turned off in csproj files. Now we've removed static attributes and allowed them to be automatically generated. In other words, attributes are present, but their values have changed - now they are always up-to-day. If you build the branch you can find the attributes in auto generated *.AssemblyInfo.cs files in OBJ directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put the import of the PowerShell.common.props before the property section in the csproj files.
That way you can do per project overrides if there is something that needs to be project specific.
Maybe even have .before.props and .after.props (or with some other naming).
Before contains defaults, and After contains common things you want to have done, but parameterized by each project properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@powercode Could you please give an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @powercode - simply move the Import so that it's before any PropertyGroup.
One example - we might move NoWarn into the PowerShellCommon.props, but in some project, we want to more/less warnings disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarify. It's good.
Done.
|
@mirichmo @daxian-dbw Could you please continue with the PR? |
PowerShellCommon.props
Outdated
| <AssemblyVersion>6.0.0.0</AssemblyVersion> | ||
|
|
||
| <ProductVersion>6.0.0-beta.2</ProductVersion> | ||
| <InformationalVersion>6.0.0-beta.2</InformationalVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beta.3 please since we created the release today. Otherwise, it looks fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is 6.0.0-beta.2 hard coded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR only targets assemblies and make multiple cleanups. I didn't want to complicate the PR and hard coded the tag.
In next PR I plan use git to get the tag dynamically. We discussed this previously in #3690.
| using System.Resources; | ||
|
|
||
| [assembly: AssemblyFileVersionAttribute("3.0.0.0")] | ||
| [assembly: AssemblyVersion("3.0.0.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the assembly version from 3.0.0.0 to 6.0.0.0 might break existing assemblies that reference to S.M.A 3.0.0.0. We need to evaluate the implication before making this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think bumping assembly version number needs to be reviewed by powershell committee before the change.
| <Import Project="..\..\PowerShellCommon.props"/> | ||
|
|
||
| <PropertyGroup> | ||
| <VersionPrefix>6.0.0</VersionPrefix> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<VersionPrefix> tag is needed to generate NuGet packages with the version like 6.0.0-alpha.3,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are the NuGet packages generated:
PS:7> dir -Name
Microsoft.PowerShell.Commands.Diagnostics.1.0.0-beta.4.nupkg
Microsoft.PowerShell.Commands.Diagnostics.1.0.0-beta.4.symbols.nupkg
Microsoft.PowerShell.Commands.Management.1.0.0-beta.4.nupkg
Microsoft.PowerShell.Commands.Management.1.0.0-beta.4.symbols.nupkg
Microsoft.PowerShell.Commands.Utility.1.0.0-beta.4.nupkg
...
They becomes 1.0.0
|
@mirichmo I don't think this PR is ready to merge yet. Please revert this merge. |
|
@mirichmo hold on the revert. Let's see if we can quickly fix the issues. |
|
@mirichmo I don't have a quick fix. I suggest reverting this merge for now and submit another PR later. |
|
This merge has been reverted via #4091. Thanks @mirichmo for the quick turnaround. |
|
😕 It's a very strange side effect. I thought PowerShell Core assembles is not Windows PowerShell assemblies, and we could be free in the change. CoreFX assemblies don't keep old versions too. Maybe a right way is to be based on packages versions? |
|
@iSazonov With By the way, I think you have to submit a new PR for this. If I submit it, it will be from my fork and thus you won't be able to make changes. It's very easy to check out a PR with the tool Again, sorry for the troubles and thanks for your understanding. |
|
@daxian-dbw Should I restore the branch for you? |
Ok! |

Related #3400
Motivation
We inherited old assembly file versions from Windows PowerShell.
Currently we shouldn't set versions of assemblies statically in
AssemblyInfo.csfiles, we should set versions of assemblies dynamically by MSBuild as discussed in #3690.Fix
AssemblyVersionandAssemblyFileVersionAttributeattributes fromAssemblyInfo.csfiles.PowerShellCommon.propsin all csproj files.Follow-Up Work
In the PR we temporarily hard code assembly versions as "6.0.0-beta.2".
Later we should set a dll version based on GitCommitId.