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

Issue: The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found #1843

Closed
buehler opened this Issue Aug 9, 2018 · 17 comments

Comments

Projects
None yet
5 participants
@buehler

buehler commented Aug 9, 2018

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.1.302
 Commit:    9048955601

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.302/

Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0

.NET Core SDKs installed:
  2.1.302 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

dotnet and dotnet-sdk were installed via brew cask install dotnet dotnet-sdk.

There are no other versions installed.


Now I've got a .net core project which is using EF core as well. My .csproj files are only referencing the target framework and the lang version:

<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.2</LangVersion>

It compiles, and it works (both on local develop and in the docker environment)

But when I add something to the data model and run dotnet ef migrations list or add the following message occurs:

> dotnet ef migrations list                                                              
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/local/share/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:
      2.1.2 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

There is NO reference to 2.1.0, like, nowhere :-)
Where is this referenced and why? I don't want to pin down the exact version in the xml :-(

I hope someone can help me with this matter.

Regards

@leecow leecow added the area-aspnet label Aug 17, 2018

@leecow

This comment has been minimized.

Member

leecow commented Aug 17, 2018

@ajcvickers

This comment has been minimized.

Member

ajcvickers commented Aug 17, 2018

@buehler What packages do you have installed?

@buehler

This comment has been minimized.

buehler commented Aug 20, 2018

@ajcvickers what do you mean by packages installed?

@buehler

This comment has been minimized.

buehler commented Aug 20, 2018

I've got dotnet sdk, and installed EFCore.

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.1" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.1" />
@davidfowl

This comment has been minimized.

davidfowl commented Aug 20, 2018

Can you show your entire csproj and .runtimeconfig.json (this is in the bin folder)

@buehler

This comment has been minimized.

buehler commented Aug 23, 2018

Of course:

csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <LangVersion>7.2</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.1" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.1" />
  </ItemGroup>
</Project>

bin/Debug/netcoreapp2.1/Time.Data.deps.json:
big bunch of json

@davidfowl

This comment has been minimized.

davidfowl commented Aug 23, 2018

@buehler Can you also specify your runtimeconfig.json. You posted your deps.json which is less important.

@buehler

This comment has been minimized.

buehler commented Aug 27, 2018

Uhm.. @davidfowl I don't really have a runtimeconfig.json Where should that file be located at? (I'm on macos)

@davidfowl

This comment has been minimized.

davidfowl commented Aug 27, 2018

@buehler So this is a class library, not an application?

@buehler

This comment has been minimized.

buehler commented Aug 28, 2018

@davidfowl Yes. This is a class library.

The structure is as follows:

/
| - BusinessLogicProject
| - DataProject
\ - WebApp

So in the BusinessLogic I reference to the Data (both are class libraries).
And entity framework is located in the dataproject. And in there, I'm trying to dotnet ef migrations list.

@davidfowl

This comment has been minimized.

davidfowl commented Aug 28, 2018

@bricelam

This comment has been minimized.

bricelam commented Aug 28, 2018

Does it work when you add...

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />

If so, I think this is a new manifestation of the "no design-time lifting" issue. (Possibly not.)

@bricelam

This comment has been minimized.

bricelam commented Aug 28, 2018

Better question: If you don't add Microsoft.EntityFrameworkCore.Design, but instead add this...

<PropertyGroup>
  <GenerateRuntimeConfigurationFiles>True</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

Does it tell you to add the design package?

@buehler

This comment has been minimized.

buehler commented Aug 29, 2018

Mhmm I've heard of the Design package.
BUT: when I add the GenerateRuntime thingy and the .csproj file looks like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <LangVersion>7.2</LangVersion>
    <GenerateRuntimeConfigurationFiles>True</GenerateRuntimeConfigurationFiles>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.1" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.1" />
  </ItemGroup>
</Project>

It works. What exactly is the issue? (So I can understand the issue and understand the consequences)

@bricelam

This comment has been minimized.

bricelam commented Aug 29, 2018

EF needs the *.runtimeConfig.json file to get framework roll forward behavior. Class libraries don't generate a *.runtimeConfig.json by default. The Design package basically adds this line to your project. If none of that happens, we fall back to running on the exact version the library is compiled against which fails if it's not installed.

@buehler

This comment has been minimized.

buehler commented Aug 31, 2018

Oh :-) well that clarifies the issue. Thanks for the help!
Would you suggest to add the design package or to add the line?

@buehler buehler closed this Aug 31, 2018

@bricelam

This comment has been minimized.

bricelam commented Aug 31, 2018

If it works just by adding the line, I'd do that--less work for NuGet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment