Net application. In project I am using custom nuget package. for example, In docker file I have used like
RUN dotnet nuget add source https://nuget.pkg.github.com/myorg/index.json -n github -u $NUGET_USER_NAME -p $NUGET_AUTH_TOKEN --store-password-in-clear-text
Now I have sonar stage in pipeline
- name: Get Coverlet.MSBuild
shell: pwsh
run: dotnet add package coverlet.msbuild
working-directory: '.\MyProject.Test'
In the above stage I am getting error Unable to find package myorg.testpackage.
So basically It is unable to find above package when I restore my project. I would like to add package myorg.testpackage when restoring in the above stage. Can someone help me how can I add this? Any help would be appreciated. Thank you
When you have a private profile, you need to make the configuration for SonarQube explicit, as well as any other operation you will perform.
I went through the same problem when I created my own NuGet packages. For me, the best way I found to solve this problem was as follows:
Create the NuGet.Config file in the solution's base directory, with the following xml snippet
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="CustomFeed" value="linkToFeed" />
</packageSources>
</configuration>
In the DockerFile, add the following snippet:
FROM ... AS BASE
WORKDIR /src
COPY ["NuGet.Config", "."]
...
This way, when you run SonarQube as well as dotnet commands, you will be able to find the source of your NuGet package.
in this link you can check nuget configuration file documentation for private packages.