Josh Schultz
Josh Schultz

Reputation: 1067

New ASP.NET Core Project does not build; "The framework 'Microsoft.NETCore.App', version '2.0.9' was not found."

Goal

To make a new ASP.NET Core project target .NET Framework

Issue

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.

Expectation

Creating a brand new project within Visual Studio should build.

Repro Steps

  1. Create a new ASP.NET Core Web Application. New Project

  2. Continue through the dialog New Project Step 2

  3. Create a .NET Framework ASP.NET Core 2.2 project as Web Application (Model-View-Controller) Select .NET Framework/ASP.NET Core 2.2 Web Application (Model-View-Controller)

  4. Run as IIS Express application

    Debug with IIS Express

  5. The build fails, and display this error message. rzc discover exited with code -2147450730. enter image description here

  6. 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 ==========
    

Things I have tried

Microsoft download page

My Questions

Misc

Upvotes: 1

Views: 1759

Answers (3)

Micah Armantrout
Micah Armantrout

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

Josh Schultz
Josh Schultz

Reputation: 1067

To resolve The framework 'Microsoft.NETCore.App', version '2.0.9' was not found. issue, this seems to work for me:

  1. Close all visual studio instances
  2. Go to add/remove programs
  3. 'Modify' the 'Microsoft .NET Core 2.0.9 - Windows Server Hosting'
  4. Click 'Repair' when the UI dialog opens up
  5. Go back into VS and attempt to run the project

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

Boluc Papuccuoglu
Boluc Papuccuoglu

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

Related Questions