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

Analyser is installed as a project dependency and not a build dependency when installed from Nuget #60

Open
JinsPeter opened this issue Mar 29, 2022 · 4 comments

Comments

@JinsPeter
Copy link

JinsPeter commented Mar 29, 2022

image
When installed SerilogAnalyzer, the package gets installed as a Project dependency rather than a build time dependency?

Below is a sample from a FxCopAnalyzer installation where the visual studio itself marked the package reference as
<PrivateAssets> All </PrivateAssets>.

image

Is there anything to be done to install SerilogAnlyzer as a Build dependency. Is it okay if we manually mark it as a PrivateAssets=All?

@Suchiman
Copy link
Owner

I don't think any of that is necessary, SerilogAnalyzer.dll is neither copied to the output directory nor are you able to access the SerilogAnalyzer namespace in your project where you are referencing the analyzer. Are there any other concerns i'm missing here? Marking it as PrivateAssets=All should be fine though, even though i don't see what that would change.

@Banner-Keith
Copy link

My understanding is that if someone were to include this in their project and generate a nuget package from that this package would be listed as a dependency and it probably shouldn't be. That's why PrivateAssets should probably be included by default.

@sungam3r
Copy link

sungam3r commented Nov 4, 2022

Are there any other concerns i'm missing here?

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <TargetFramework>netstandard2.0</TargetFramework>
    <IsPackable>true</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
  </ItemGroup>

</Project>

From NugetPackageExplorer on dummy project built with SerilogAnalyzer:
изображение

@cremor
Copy link

cremor commented Aug 24, 2023

@Suchiman Your package should be flagged as a developmentDependency. If it has that flag then Visual Studio should automatically create correct attributes in the <PackageReference> tag for your users to not include it as a dependency.

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

5 participants