FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Set assembly versions by MSBuild by iSazonov · Pull Request #3917 · PowerShell/PowerShell · GitHub

Set assembly versions by MSBuild - #3917

Merged
Mike Richmond (mirichmo) merged 3 commits into
PowerShell:masterfrom
iSazonov:csproj-common-props
Jun 23, 2017
Merged

Set assembly versions by MSBuild#3917
Mike Richmond (mirichmo) merged 3 commits into
PowerShell:masterfrom
iSazonov:csproj-common-props

Conversation

Ilya (iSazonov) commented Jun 2, 2017
edited
Loading

Copy link
Copy Markdown
Collaborator

Related #3400

Motivation

We inherited old assembly file versions from Windows PowerShell.
Currently we shouldn't set versions of assemblies statically in AssemblyInfo.cs files, we should set versions of assemblies dynamically by MSBuild as discussed in #3690.

Fix

  1. Remove AssemblyVersion and AssemblyFileVersionAttribute attributes from AssemblyInfo.cs files.
  2. Put all common properties in PowerShellCommon.props including version related properties.
  3. Import PowerShellCommon.props in 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.

<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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Where did all of these come from? We need to document the justification for all warnings that we ignore.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Ilya (iSazonov) Jun 7, 2017
edited
Loading

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I reviewed the warnings - all belong to XML comments and we have TONs warnings - It takes a lot of work to fix it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

All of the GenerateAssembly* entries are missing. I'm assuming it was intentional. Can you please explain?

Ilya (iSazonov) Jun 7, 2017
edited
Loading

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Staffan Gustafsson (@powercode) Could you please give an example?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I agree with Staffan Gustafsson (@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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for clarify. It's good.
Done.

Copy link
Copy Markdown
Collaborator Author

Mike Richmond (@mirichmo) Dongbo Wang (@daxian-dbw) Could you please continue with the PR?

Comment thread PowerShellCommon.props Outdated
<AssemblyVersion>6.0.0.0</AssemblyVersion>

<ProductVersion>6.0.0-beta.2</ProductVersion>
<InformationalVersion>6.0.0-beta.2</InformationalVersion>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

beta.3 please since we created the release today. Otherwise, it looks fine to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why is 6.0.0-beta.2 hard coded?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Mike Richmond (mirichmo) merged commit c549925 into PowerShell:master Jun 23, 2017
Ilya (iSazonov) deleted the csproj-common-props branch June 23, 2017 05:05
using System.Resources;

[assembly: AssemblyFileVersionAttribute("3.0.0.0")]
[assembly: AssemblyVersion("3.0.0.0")]

Dongbo Wang (daxian-dbw) Jun 23, 2017
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

<VersionPrefix> tag is needed to generate NuGet packages with the version like 6.0.0-alpha.3,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Mike Richmond (@mirichmo) I don't think this PR is ready to merge yet. Please revert this merge.
@PowerShell/powershell-maintainers I didn't get the time to thoroughly review all PRs related to .csproj changes. Let's hold on merging them.

Copy link
Copy Markdown
Member

Mike Richmond (@mirichmo) hold on the revert. Let's see if we can quickly fix the issues.

Dongbo Wang (daxian-dbw) commented Jun 23, 2017
edited
Loading

Copy link
Copy Markdown
Member

Mike Richmond (@mirichmo) I don't have a quick fix. I suggest reverting this merge for now and submit another PR later.
Steve Lee (@SteveL-MSFT) what do you think?

Dongbo Wang (daxian-dbw) commented Jun 23, 2017
edited
Loading

Copy link
Copy Markdown
Member

This merge has been reverted via #4091. Thanks Mike Richmond (@mirichmo) for the quick turnaround.
Ilya (@iSazonov) Sorry for the troubles ☹️ Lesson learned: if you think a PR is risky but don't yet have the time to thoroughly review, leave a comment to point out that you need more time so that everyone is on the same page. I will open a new PR for this change.

Copy link
Copy Markdown
Collaborator Author

😕 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?

Copy link
Copy Markdown
Member

Ilya (@iSazonov) With netstandard2.0 we expect most of the existing Windows powershell modules to work on powershell core without change. They were built against 3.0.0.0 S.M.A.dll, so we want to make sure nothing will break there.

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 hub. Once you get that tool, you can do things like this to get the changes from this PR:

## It will get the changes from this PR to a local branch named iSazonov-csproj-common-props
hub checkout https://github.com/PowerShell/PowerShell/pull/3917
## Then rebase this branch and push it to your fork
## Then submit a new PR with that remote branch

Again, sorry for the troubles and thanks for your understanding.

Copy link
Copy Markdown
Collaborator Author

Dongbo Wang (@daxian-dbw) Should I restore the branch for you?

Copy link
Copy Markdown
Collaborator Author

I think you have to submit a new PR for this.

Ok!

Ilya (iSazonov) restored the csproj-common-props branch June 23, 2017 18:01
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
* Update assemblies versions by MSBuild and create a new PowerShellAssembly.props file to consolidate properties.

* Move import on first place

* Move to "6.0.0-beta.3"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL