10000 'PackageVersion' is reset to '1.0.0' · Issue #1557 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

'PackageVersion' is reset to '1.0.0' #1557

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

Closed
iSazonov opened this issue Aug 31, 2017 · 5 comments
Closed

'PackageVersion' is reset to '1.0.0' #1557

iSazonov opened this issue Aug 31, 2017 · 5 comments

Comments

@iSazonov
Copy link

In PowerShell Core repo we have explicitly assign 'PackageVersion' because there is a issue: in debug file, we can see that 'PackageVersion' is correctly assigned as 'Version' in 'NuGet.targets' but then immediately redefined as '1.0.0'.

@nguerrera
Copy link
Contributor

@iSazonov Can you provide a simple repro demonstrating the issue? By immediately redefined, do you mean also in NuGet.targets?

cc @rohit21agrawal

@iSazonov
Copy link
Author

Can you provide a simple repro demonstrating the issue?

On next Monday I'll try to make it.

By immediately redefined, do you mean also in NuGet.targets?

Yes, in log file I see that just after the task complete 'PackageVersion' is assigned to '1.0.0'

@iSazonov
Copy link
Author
iSazonov commented Sep 8, 2017

TestBuild.zip

I attach a file with simple repo.
If we uncomment line <PackageVersion>$(PSCoreBuildVersion)</PackageVersion> we get package with right version.

@nguerrera
Copy link
Contributor
nguerrera commented Sep 8, 2017

The problem is that Version is being set in a target. During static evaluation before any targets are run, a default value of Version = 1.0.0 is picked and that flows to PackageVersion default (also during static evaluation). If you change either of these after evaluation in a target, there is no magic way for it to impact the other property.

This comment is inaccurate:

  <!--
            We have explicitly assign 'PackageVersion'
            because there is a bug: 'PackageVersion' is correctly assigned as 'Version' in 'NuGet.targets'
            but then immediately redefined as '1.0.0'.

It should be something like this:

<!--
We have to explicitly assign 'PackageVersion' here because we're changing 'Version' in a target. Before any targets 
have run (during static evaluation), 'Version' will have defaulted to '1.0.0' and PackageVersion will have defaulted to
'Version'. So we must update both 'Version' and 'PackageVersion' here.

This isn't a bug as there's no way to make PackageVersion a dynamic property that automatically changes when Version changes dynamically in a target.

@iSazonov
Copy link
Author
iSazonov commented Sep 8, 2017

@nguerrera Thanks for clarify.
I was hoping that SDK could be changed to eliminate this problem, maybe moving the properties in a target to benefit from conditional execution.

xtqqczze added a commit to xtqqczze/PowerShell-PowerShell that referenced this issue Apr 29, 2020
Add documentation of why `PackageVersion` is used in `PowerShell.Common.props`. Explamation is copied from [dotnet/sdk](dotnet/sdk#1557 (comment))

Co-Authored-By: Nick Guerrera <nicholg@microsoft.com>
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

No branches or pull requests

2 participants
0