Reputation: 10400
I am trying to simply follow this guide to set up a simple app with authentication.
When I try entering this command
dotnet aspnet-codegenerator identity -dc WebApp1.Data.ApplicationDbContext --files "Account.Register;Account.Login;Account.Logout"
To scaffold a few pages, I get this error
It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '2.1.6' was not found. - Check application dependencies and target a framework version installed at: C:\Program Files\dotnet - Installing .NET Core prerequisites might help resolve this problem: http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 - The .NET Core framework and SDK can be installed from: https://aka.ms/dotnet-download - The following versions are installed: 1.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.0.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.0.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.0.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.1.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.1.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.1.10 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.1.0-preview1-26216-03 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.1.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.1.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
I added the nuget package Microsoft.EntityFrameworkCore.Design
as suggested here but with no effect.
I followed the link to downlowd '.NET core prerequisites`, but this just has the .net sdk...
I have not specified any 2.1.6
anywhere in my project - where would that even be? I also searched the internet for .net core framework 2.1.6 but that doesn't exist..
my csproj file looks like this
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>aspnet-SocFace-D83867AE-294A-4562-B8D7-10674D5B4C05</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" PrivateAssets="All" />
</ItemGroup>
I tried including a version for Microsoft.AspNetCore.App
like this:
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5"/>
but it made no difference
Upvotes: 1
Views: 1872
Reputation: 15621
Here's a version of your Error Message to make clear what's happening:
The specified framework 'Microsoft.NETCore.App', version '2.1.6' was not found.
The following versions are installed:
1.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
...
2.1.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Apparently you've specified the target framework to be version 2.1.6, while the highest version you have installed is 2.1.5. Install version 2.1.6 (or re-target to 2.1.5) and you should be good to go.
EDIT:
According to the Microsoft.NETCore.App page on NuGet version 2.1.6 is a prerelease version. Same for Microsoft.AspNetCore.App
. Explicitly setting the versions for your references should solve this issue.
Upvotes: 1