Skip to content
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

nuspec exclude="Analyzers" ineffective, analyzers are still brought in #7426

Closed
AArnott opened this issue Oct 23, 2018 · 1 comment
Closed

Comments

@AArnott
Copy link
Contributor

AArnott commented Oct 23, 2018

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): dotnet.exe

dotnet.exe --version (if appropriate): 2.2.200-preview-009431

Every single dependency in the streamjsonrpc 2.0.102-beta package has exclude="Build,Analyzers" on it. Yet installing it in a .NET Core project adds analyzers from the Microsoft.VisualStudio.Threading.Analyzers package, which streamjsonrpc indirectly depends on through its Microsoft.VisualStudio.Threading package dependency.

Detailed repro steps so we can see the same problem

  1. Create a csproj with this content:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="StreamJsonRpc" Version="2.0.102-beta" />
  </ItemGroup>  

</Project>
  1. Then create a Program.cs file with this content:
using System;
using System.Threading.Tasks;

namespace ConsoleApp30
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            FooAsync().Wait();
        }

        static async Task FooAsync() {

        }
    }
}
  1. run dotnet build

EXPECTED

No VSTHRD002 build warning.

ACTUAL

The build warnings include one from VSTHRD002.

See sample: ConsoleApp30.zip

@nkolev92
Copy link
Member

Thanks for filing this @AArnott

As analyzers were initially done without any work from NuGet team, this is a well known gap.

I consider this a duplicate of #6279.
I am closing this now in favor of that, please let me know if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants