dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.98k stars 4.66k forks source link

Invalid AssemblyVersion in ref subfolder of System.ComponentModel.Annotations package #61778

Open sokolovsa opened 2 years ago

sokolovsa commented 2 years ago

Description

Nuget package System.ComponentModel.Annotations versions: 6.0.0-preview.4.21253.7 5.0.0 4.7.0

ref assembly in package subfolder ref/netstandard2.0 and assembly in subfolder lib/netstandard2.0 have different AssemblyVersion attribute ref assembly has AssemblyVersion=4.2.0 real assembly has AssemblyVersion=4.2.1

Reproduction Steps

Expected behavior

the output dll has reference to System.ComponentModel.Annotations v 4.2.1

Actual behavior

the output dll has reference to System.ComponentModel.Annotations v 4.2.0

Regression?

No response

Known Workarounds

No response

Configuration

.net standard 2.0

Other information

No response

ghost commented 2 years ago

Tagging subscribers to this area: @ajcvickers, @bricelam, @roji See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Nuget package System.ComponentModel.Annotations versions: 6.0.0-preview.4.21253.7 5.0.0 4.7.0 ref assembly in package subfolder ref/netstandard2.0 and assembly in subfolder lib/netstandard2.0 have different AssemblyVersion attribute ref assembly has AssemblyVersion=4.2.0 real assembly has AssemblyVersion=4.2.1 ### Reproduction Steps * create any .net standard 2.0 dll project and add package reference to System.ComponentModel.Annotations 5.0.0 * build the project * inspect the output dll in reflector/dotpeek etc ### Expected behavior the output dll has reference to System.ComponentModel.Annotations v 4.2.1 ### Actual behavior the output dll has reference to System.ComponentModel.Annotations v 4.2.0 ### Regression? _No response_ ### Known Workarounds _No response_ ### Configuration .net standard 2.0 ### Other information _No response_
Author: sokolovsa
Assignees: -
Labels: `area-System.ComponentModel.DataAnnotations`, `untriaged`
Milestone: -
bormm commented 2 years ago

I think this is a duplicate of https://github.com/dotnet/runtime/issues/41221 unfortunately Microsoft has created a bigger issue than described. So closing it and blocking from comments was not very nice. It is not possible to do a binding redirect for a PowerShell (non-Core) module of course just easily as descripted. So we got in dependency hell again because this version mess. We have to do the redirect now via code as descripted here https://devblogs.microsoft.com/powershell/resolving-powershell-module-assembly-dependency-conflicts/

aparajit-pratap commented 2 months ago

I opened a similar issue here before realizing this one already existed. Linking the issue here for more details.

tarekgh commented 2 months ago

There is an ask to add some public doc explaining the issue and workarounds.