简体   繁体   中英

Roslyn SDK cannot locate the nuget package locally

I am trying to write custom rules in sonar for C#. After doing some research, got something on how to write rules and integrate with sonar. For the reference please look at the post https://stackoverflow.com/a/53889326/6499361 .

So basically we have to follow three steps to do so:

  1. Use Roslyn to Write a Live Code Analyzer.Building this project will generate a .nupkg file
  2. Use the SonarQube Roslyn SDK to generate a custom SonarQube plugin that wraps the Roslyn analyzer.Running this tool will generate a jar. I am using RoslynSDK-2.0
  3. Use the generated jar file as a rule in Sonar, which could be integrated to sonar by using it as a plugin

I have written analyzer code which works fine.I have the .nupkg file with me which is generated after building the project. Now I want to generate a plugin for sonar. So when I run the generator tool by following command:

RoslynSonarQubePluginGenerator /a:AnalyzerExample.1.0.6971.18074.nupkg

I get the following error:

No packages with the specified id were found: AnalyzerExample.1.0.6971.18074.nupkg

I have tried putting the .nupkg file at different locations, as mentioned in the following post: https://github.com/SonarSource/sonarqube-roslyn-sdk#configuring-nuget-feeds
I have attached images, when I run Roslyn plugin generator.

Screenshot of the error

The parameter you are passing to the RoslynSonarQubePluginGenerator isn't quite right.

You just need to pass the id of your NuGet package to the generator, not the full name of the package file eg

RoslynSonarQubePluginGenerator /a:AnalyzerExample

If there are multiple versions of the package, the generator will use the latest released version. If you want to pick a specific version, add a colon and the version to the command line eg

RoslynSonarQubePluginGenerator /a:AnalyzerExample:1.0.6971.18074

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM