Unable to find package Microsoft.NETCore.App with version(>=3.0.0)

Viewed 15479

I am trying to migrate my WPF(.net framework) project to WPF(.net core 3). So i have installed this Visual Studio Extension and i m now able to create a new Wpf(.net core) project , but the problem starts when i add a nuget package ! , VS throws me this error :

Unable to find package Microsoft.NETCore.App with version (>= 3.0.0-preview6-27730-01)
- Found 69 version(s) in nuget.org [ Nearest version: 3.0.0-preview5-27626-15 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages    TestwpfCore C:\Users\sintware\source\repos\TestwpfCore\TestwpfCore\TestwpfCore.csproj   1   
4 Answers

As dotnet core 3.0 is still in preview, you should put the following in a file called NuGet.Config in the root of your project (or merge with your existing file):

<configuration>
  <packageSources>
    <add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
    <add key="dotnet-windowsdesktop" value="https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json" />
    <add key="aspnet-aspnetcore" value="https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json" />
    <add key="aspnet-aspnetcore-tooling" value="https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json" />
    <add key="aspnet-entityframeworkcore" value="https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json" />
    <add key="aspnet-extensions" value="https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json" />
    <add key="gRPC repository" value="https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev" />
  </packageSources>
</configuration>

This will make sure the preview versions can be found!

This information can be found here: https://github.com/dotnet/core-sdk#installers-and-binaries

As soon as dotnet core 3.0 is released you should be able to remove these package sources.

Notice the error message says it's trying to find a package with version 3.0.0 preview6. If you go to https://dotnet.microsoft.com/download/dotnet-core/3.0 you can see the latest public preview is preview 5. Therefore you, or the tool you used to migrate, is trying to use a nightly build of the .NET Core SDK, not a published version. The .NET SDK normally ships with its packages which get put in the NuGet Fallback Folder, so it appears that version of the .NET Core SDK wasn't installed correctly.

I know nothing of that extension you linked, plus it's not a Microsoft extension, so while I appreciate the effort the developer made to create it, I don't know if it works "correctly". Plus .NET Core 3.0 still isn't generally available, so maybe the extension worked with previous previews but something changed.

My suggestion is to install the latest .NET Core 3.0 preview from the download page, go to an empty directory and run "dotnet new wpf", then copy all your code and xaml into that new directory. I don't trust migration tools, I prefer to do it myself manually, so I understand what's being changed.

After getting @Lance is comment , i downloaded the Core 3 preview 6 and finally the problem is gone ,i can install nuget package without any problem.

Bumping up the Agent Specification from windows-2017 to windows-2019 did it for me

Related