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

dotnet restore --configFile <file> does not restore custom MsBuild SDKs #8183

Closed
Daniel-Khodabakhsh opened this issue Jun 3, 2019 · 1 comment
Labels
Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Resolution:Duplicate This issue appears to be a Duplicate of another issue

Comments

@Daniel-Khodabakhsh
Copy link

Daniel-Khodabakhsh commented Jun 3, 2019

When using dotnet restore --configFile <NuGet config file>, and if you are using a custom MsBuild SDK in a csproj, dotnet restore will fail to retrieve the SDK.

This error does not happen if you just run dotnet restore.

This happens with all the ways the SDK can be referenced in the project.
Here is an example of how a custom SDK can be referenced:

<Project Sdk="xxx.Sdk.App">
    ...
</Project>

NuGet.config file I'm using, but this error also occurs when <packageSourceCredentials> are included.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Production" value="https://xxx.pkgs.visualstudio.com/_packaging/Production/nuget/v3/index.json" />
    <add key="PreRelease" value="https://xxx.pkgs.visualstudio.com/_packaging/PreRelease/nuget/v3/index.json" />
    <add key="DevFeeds" value="https://xxx.pkgs.visualstudio.com/_packaging/DevFeeds/nuget/v3/index.json" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Details about Problem

NuGet product used: dotnet.exe

NuGet version: N/A

dotnet.exe --version: 2.2.204 & 2.2.300

OS version:

  • win10 1803 17134.407
  • Azure DevOps
    • Hosted Ubuntu 1604
    • Hosted VS2017

Worked before? If so, with which NuGet version: N/A

Detailed repro steps so we can see the same problem

  1. Install https://github.com/Microsoft/artifacts-credprovider

  2. Create a .NET-Core MsBuild SDK NuGet project and upload it to a NuGet feed.

  3. Create a .NET-Core project which consumes the SDK project created in step 1. Make sure to include a nuget.config file which references the feed the SDK package is hosted from.

  4. Run dotnet restore and notice no issue. (You may have to run dotnet restore --interactive the first time).

  5. Delete the custom SDK from your NuGet cache (C:\Users\<USER>\.nuget\packages\<SDK package>)

  6. Delete contents of C:\Users\dkhodabakhsh\AppData\Local\Temp

  7. Run dotnet restore --configFile nuget.config and notice the error.

  8. Then run dotnet restore and notice that it restored successfully.

  9. Repeat steps 5-7 and notice the error again.

Verbose Logs

Build started 2019-06-03 11:26:21 AM.
     0>Resolving SDK 'xxx.Sdk.App'...
       Running restore with 12 concurrent jobs.
       Reading project file C:\Users\dkhodabakhsh\AppData\Local\Temp\97e2260d-4b3f-411d-9b50-4cd1b1c0fdfd.
       Persisting no-op dg to C:\Users\dkhodabakhsh\AppData\Local\Temp\97e2260d-4b3f-411d-9b50-4cd1b1c0fdfd.nuget.dgspec.json
       Restoring packages for C:\Users\dkhodabakhsh\AppData\Local\Temp\97e2260d-4b3f-411d-9b50-4cd1b1c0fdfd...
       Restoring packages for .NETStandard,Version=v0.0...
       Using C:\Users\dkhodabakhsh\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll as a credential provider plugin.
         GET https://api.nuget.org/v3-flatcontainer/xxx.sdk.app/index.json
         NotFound https://api.nuget.org/v3-flatcontainer/xxx.sdk.app/index.json 352ms
       Resolving conflicts for .NETStandard,Version=v0.0...
     0>D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
     0>D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : Unable to load the service index for source https://companyX.pkgs.visualstudio.com/_packaging/Production/nuget/v3/index.json.
     0>D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : Unable to load the service index for source https://companyX.pkgs.visualstudio.com/_packaging/PreRelease/nuget/v3/index.json.
     0>D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : Unable to load the service index for source https://companyX.pkgs.visualstudio.com/_packaging/DevFeeds/nuget/v3/index.json.
     0>D:\git\xxx.App\src\xxx.App\xxx.App.csproj : error : Unable to find package xxx.Sdk.App. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org, DevFeeds, Production, PreRelease
       MSB4236: The SDK 'xxx.Sdk.App' specified could not be found.
       MSB4236: The SDK 'xxx.Sdk.App' specified could not be found.
       The target "BeforeBuild" listed in a BeforeTargets attribute at "D:\git\xxx.App\src\xxx.App\xxx.App.csproj (35,37)" does not exist in the project, and will be ignored.
       The target "_GetRestoreSettings" listed in a BeforeTargets attribute at "D:\git\xxx.App\src\xxx.App\xxx.App.csproj (44,29)" does not exist in the project, and will be ignored.
     1>Project "D:\git\xxx.App\src\xxx.App\xxx.App.csproj" on node 1 (Restore target(s)).
     1>Building with tools version "Current".
       Target "Restore" skipped. The target does not exist in the project and SkipNonexistentTargets is set to true.
     1>Done Building Project "D:\git\xxx.App\src\xxx.App\xxx.App.csproj" (Restore target(s)).

Build succeeded.

         D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
         D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : Unable to load the service index for source https://companyX.pkgs.visualstudio.com/_packaging/Production/nuget/v3/index.json.
         D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : Unable to load the service index for source https://companyX.pkgs.visualstudio.com/_packaging/PreRelease/nuget/v3/index.json.
         D:\git\xxx.App\src\xxx.App\xxx.App.csproj : warning : Unable to load the service index for source https://companyX.pkgs.visualstudio.com/_packaging/DevFeeds/nuget/v3/index.json.


         D:\git\xxx.App\src\xxx.App\xxx.App.csproj : error : Unable to find package xxx.Sdk.App. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org, DevFeeds, Production, PreRelease

    4 Warning(s)
    1 Error(s)

Time Elapsed 00:00:05.32

Sample Project

TODO

@nkolev92
Copy link
Member

nkolev92 commented Jun 3, 2019

Duplicate of #7855.

Consider providing the config file in the path rather than specifying it explicitly.
The technical limitation for addressing this problem are severe.

fyi @jeffkl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Resolution:Duplicate This issue appears to be a Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants