Skip to content

Set version early enough not to be overridden by winfx targets on desktop - #819

Merged
srivatsn merged 3 commits into
dotnet:masterfrom
nguerrera:version-issue
Feb 5, 2017
Merged

srivatsn merged 3 commits into
dotnet:masterfrom
nguerrera:version-issue

Conversation

@nguerrera

@nguerrera nguerrera commented Feb 4, 2017 •

Copy link
Copy Markdown
Contributor

Customer scenario

  • net4x package version should be same as other platforms (1.0.0), but it is currently 1.0.0.0 (one too many zeros)
  • VersionPrefix has no impact on net4x projects
  • Projects multi-targeting net4x and netcoreapp and using default version will fail to nuget restore in VS

Fix #814
Fix #422
Fix #93

Workarounds, if any

None for VersionPrefix not working on net4x.
For the others, specify an explicit Version in your .csproj

Risk

Low.

Performance impact

None

Is this a regression from a previous update?

The nuget restore may have worked before but the version prefix issue has always existed. The fix is the same for both.

Root cause analysis:

Missing test coverage for version prefix using desktop msbuild (added with PR).

How was the bug found?

Dogfooding and customer reported

@srivatsn @dsplaisted @eerhardt @dotnet/project-system

This prevents a conflict with Version being set to 1.0.0.0 by
desktop targets before we have a chance to set it to 1.0.0, which
was breaking restore. It also breaks VersionPrefix for net4x
projects built with desktop msbuild.

Also leaving VersionPrefix unset if we do not use it.
@nguerrera nguerrera changed the title [WIP] Version fix Set version early enough not to be overridden by winfx targets on desktop Feb 4, 2017
@srivatsn

srivatsn commented Feb 4, 2017

Copy link
Copy Markdown
Contributor

Tagging @MattGertz for approval.

}

var testAsset = _testAssetsManager
.CopyTestAsset("HelloWorld", identifier: targetFramework)

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.

Does the identifier need to be unique by itself? Or is something else appended to it to make it unique.

If it has to be unique, just the TFM probably isn't enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is appended to the caller member name.

<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDriectory)Microsoft.NET.DefaultAssemblyInfo.targets" />

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.

typo: Driectory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I guess imports are already relative to current dir, this is unnecessary and evaluating to empty, which still works. I'll correct the typo and keep it this way for consistency but we should probably remove the unnecessary uses of MSBuildThisFileDirectory for readability at some point.

@Petermarcu

Copy link
Copy Markdown
Member

@dotnet-bot test this please

This was benign because imports are already relative to the importing
project and the misspelling of MSBuildThisFileDirectory evaluated to
empty.
@srivatsn

srivatsn commented Feb 5, 2017

Copy link
Copy Markdown
Contributor

Approved offline

@srivatsn
srivatsn merged commit b11de8d into dotnet:master Feb 5, 2017
mmitche pushed a commit to mmitche/sdk that referenced this pull request Jun 5, 2020
Adding support for publishing via YAML Stages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

8 participants