-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Custom metadata on framework references is ignored when a NuGet package references the same assembly #1443
Comments
This issue was moved to dotnet/roslyn#21060 |
@rainersigwald The main indicator to me that this was a bug for dotnet/sdk is the fact that the above reference works fine in the legacy project system. See DotNetAnalyzers/StyleCopAnalyzers#2426. |
I also wasn't able to get an alias for System working using this approach:
|
You're right, this is closer to an SDK issue than Roslyn. I have more information but have to step away for a minute; I'll update with my investigation in a couple of hours. |
Ok, this is indeed more interesting. Here's a binary log showing the problem on the StyleCopyAnalyzers PR: sdk1443_repro_binlog.zip It shows that Fortunately, framework package references are conditioned, so this can be worked around: Workarounddiff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj b/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
index 3e1bf760..021b7924 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
@@ -12,6 +12,8 @@
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\build\keys\TestingKey.snk</AssemblyOriginatorKeyFile>
+
+ <DisableLockFileFrameworks>true</DisableLockFileFrameworks>
</PropertyGroup>
<ItemGroup>
@@ -26,7 +28,7 @@
</ItemGroup>
<ItemGroup>
- <Reference Update="System">
+ <Reference Include="System">
<Aliases>global,system</Aliases>
</Reference>
</ItemGroup> I'm not sure what the ideal behavior is here. Avoid adding redundant references from package framework references? Merge metadata instead? @dsplaisted @natidea Thoughts? |
I believe I've run into another side effect of this issue in #1469. In my case, I'd actually want the reference from the project system to win over the one from the package. Merging the metadata would not solve the problem, because that would mean it would still have Pack=false. My vote is to drop the package references. |
I see this currently has no milestone. Any update on when this is likely to be fixed? |
@nguerrera Any thoughts on when this might get prioritized? |
@nguerrera Coming up on a year since I last asked about this. Any chance of it getting fixed? |
I think this was fixed. I recall @dsplaisted making changes around this. |
Assigned to @dsplaisted to confirm if this has been addressed. |
I just tested my scenario described in #1469 (which was closed as a dupe of this issue) with VS 2019 RC1 and the 2.2.200 SDK, and the problem does not appear to be fixed. The package still doesn't have the framework references it should have. |
It's possible we can close this, but need to reopen #1469. I specifically recall fixing something around aliases. Maybe it was something else. |
This looks similar to #2254, which I started working on a while ago, but never finished |
…0200508.11 (dotnet#1443) - Microsoft.AspNetCore.Analyzers: 5.0.0-preview.5.20258.1 -> 5.0.0-preview.5.20258.11 - Microsoft.AspNetCore.Mvc.Analyzers: 5.0.0-preview.5.20258.1 -> 5.0.0-preview.5.20258.11 - Microsoft.AspNetCore.Components.Analyzers: 5.0.0-preview.5.20258.1 -> 5.0.0-preview.5.20258.11 - Microsoft.AspNetCore.Mvc.Api.Analyzers: 5.0.0-preview.5.20258.1 -> 5.0.0-preview.5.20258.11 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label. |
As demonstrated in DotNetAnalyzers/StyleCopAnalyzers#2499, it appears impossible to assign a new alias to the System reference. I used the following code to add the alias:
Attempts to use members of this assembly qualified with
system::
instead ofglobal::
resulted in build errors of the following form:🔗 Here is an AppVeyor build showing the output from a command line build: https://ci.appveyor.com/project/sharwell/stylecopanalyzers/build/1.0.3133
The text was updated successfully, but these errors were encountered: