Reputation: 1067
To make a new ASP.NET Core project target .NET Framework
When I create a new project I get the error message The framework 'Microsoft.NETCore.App', version '2.0.9' was not found.
as I try to build the newly created project.
Creating a brand new project within Visual Studio should build.
Create a .NET Framework ASP.NET Core 2.2 project as Web Application (Model-View-Controller)
Run as IIS Express application
The build fails, and display this error message. rzc discover exited with code -2147450730.
If I go to the Output
tab and look at the build text, I find this:
Target ResolveTagHelperRazorGenerateInputs:
1> Creating "obj\Debug\net461\MyApp.TagHelpers.input.cache" because "AlwaysCreate" was specified.
1> It was not possible to find any compatible framework version
1> The framework 'Microsoft.NETCore.App', version '2.0.9' was not found.
1> - The following frameworks were found:
1> 3.1.3 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
1> 3.1.5 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
1>
1> You can resolve the problem by installing the specified framework and/or SDK.
1>
1> The specified framework can be found at:
1> - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.9&arch=x86&rid=win10-x86
1> C:\Users\joshs\.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79,5): error : rzc discover exited with code -2147450730.
1>Done building target "ResolveTagHelperRazorGenerateInputs" in project "MyApp.csproj" -- FAILED.
1>
1>Done building project "MyApp.csproj" -- FAILED.
1>
1>Build FAILED.
1> 1>C:\Users\joshs\.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79,5): error : rzc discover exited with code -2147450730.
1> 0 Warning(s)
1> 1 Error(s)
1>
1>Time Elapsed 00:00:23.79
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have gone to the URL noted in the error message, but get this from Microsoft's download page:
I tried to create a .NET Framework ASP.NET Core 3.1 project, but that template doesn't exist. I made a .NET Core ASP.NET Core 3.1 and tried to change the target framework to net471, but that didn't work.
I thought maybe there was an SDK I'm missing for creating a 3.1 .net Framework project (and there still may be), but I didn't see anything obvious.
How do I create an ASP.NET Core 2.2 project that builds correctly? I noticed the error message complains about 2.0.9
, why isn't it using 2.2.x
? To my knowledge 2.0 is EOL, but 2.2 is LTS (long term support) edit: this is wrong, why can't I download the framework/SDK for this 2.2 project?
How do I create an ASP.NET Core 3.1 project that targets .NET Framework? (Is this even possible?)
Visual Studio 2019 (Version 16.6.2)
Windows 10 Machine
Upvotes: 1
Views: 1759
Reputation: 6971
I had the same issue with the same exact error and looked to see how Josh Schultz fixed this issue. I didn't have 'Microsoft .NET Core 2.0.9 - Windows Server Hosting' but I did have 'Microsoft .Net 5.0.6 - Windows Server Hosting' I did a repair on that and got past the issue.
Upvotes: 0
Reputation: 1067
To resolve The framework 'Microsoft.NETCore.App', version '2.0.9' was not found.
issue, this seems to work for me:
I've had this be a problem for me 3 times in the past 4 months, and this always fixes it for me.
Upvotes: 0
Reputation: 2346
You can try downloading the SDK for 3.1 here :
https://dotnet.microsoft.com/download/dotnet-core/3.1
The left side of the page contains SDK's and the right side runtimes. Try and install a 3.1 SDK.
Also, you can download a SDK for 2.2 here that can be used with VS2019:
https://dotnet.microsoft.com/download/dotnet-core/2.2
Upvotes: 1