I'm working to automate my build Devops Pipelines. My Visual Studio (15.9.7) build succeeds, but when I try the build in Devops Pipelines, I get the error:
Error : NETSDK1061: The project was restored using
Microsoft.NETCore.App version 1.0.0,
but with current settings, version 2.1.0 would be used instead.
To resolve this issue, make sure the same settings are used for
restore and for subsequent operations such as build or publish.
Typically this issue can occur if the RuntimeIdentifier property is
set during build or publish but not during restore. For more
information, see
https://aka.ms/dotnet-runtime-patch-selection.
I've tried using a Microsoft build agent (VS2017) as well as using the machine where I have a successful build from Visual Studio. In both cases, I get the same error.
I've looked for references to Microsoft.NETCore.App using text searches across all the files and am not finding any references to 1.0.0.
As another data point, here's my output of dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 2.2.103
Commit: 8edbc2570a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.103\
Host (useful for support):
Version: 2.2.1
Commit: 878dd11e62
.NET Core SDKs installed:
2.1.503 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.2.103 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
The fix for my issue turned out to be in another question on StackOverflow that I missed in my original searches. The fix was to:
Set the RuntimeIdentifiers property to a semicolon-separated list of all the RIDs to be published.
Set the TargetLatestRuntimePatch property to true.
Related
I have executed
>dotnet ef dbcontext scaffold connectionString EntityFrameworkCore.SqlServer
It generated files but with warning about freshest version is available.
I installed the latest one
>dotnet tool install -g dotnet-ef
Then again:
dotnet ef dbcontext scaffold connectionString EntityFrameworkCore.SqlServer
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.2' was not found.
- The following frameworks were found:
2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.1.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.0-preview3.19553.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.2' was not found.
How to run the dotnet ef or how I can rollback to the previous version?
I have run the following command to update my EF Core Tools:
dotnet tool update --global dotnet-ef
After running it, I tried to run
dotnet ef --version
But then it threw this error:
It was not possible to find any compatible framework version The
framework 'Microsoft.NETCore.App', version '3.1.2' was not found.
- The following frameworks were found:
2.1.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework
and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.2&arch=x64&rid=win10-x64
After seeing it I followed the link and downloaded all possible packages but nothing changed.
How do I resolve this problem?
I have found a way to solve this problem. Worth noting, however, it's not the best approach:
dotnet tool uninstall --global dotnet-ef
dotnet tool install --global dotnet-ef --version 3.1.1
What packages did you download?
The dotnet ef you are using is of version 3.1.2 but
your .net core desktop runtime 3.1 version is below the version 3.1.2
All you need to do is to download the .net core runtime 3.1 version 3.1.2
https://dotnet.microsoft.com/download/dotnet-core/3.1/runtime/?utm_source=getdotnetcore&utm_medium=referral
I am trying to use EF Core 3 in the latest (preview) version of Azure functions, but I am getting the following error when I try interacting with the database:
System.Private.CoreLib: Exception while executing function: DemoFunction. Microsoft.Data.SqlClient: Microsoft.Data.SqlClient is not supported on this platform.
I have a web app in the same solution that works just fine with the same setup, and there is nothing special about my "platform". This is the output from dotnet --info:
.NET Core SDK (reflecting any global.json): Version:
3.1.100-preview2-014569 Commit: 4bd5d24d87
Runtime Environment: OS Name: Windows OS Version: 10.0.18362
OS Platform: Windows RID: win10-x64 Base Path: C:\Program
Files\dotnet\sdk\3.1.100-preview2-014569\
Host (useful for support): Version: 3.1.0-preview2.19525.6 Commit:
5672978d91
.NET Core SDKs installed:
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.100-preview2-014569 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.12
[C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0-preview2.19528.8 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App
2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.13 [C:\Program
Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App
3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.0-preview2.19525.6 [C:\Program
Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program
Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.0-preview2.19525.6 [C:\Program
Files\dotnet\shared\Microsoft.WindowsDesktop.App]
I have created a minimal reproduction of the issue here, just start up the functions project and send it an HTTP request (same with the web app).
Is it currently possible to use EF Core 3 with v3 Azure Functions? (FYI I have a v2 Functions app running with EF Core 2.1)
This issue has been solved , copy OP's comment , it will be helpful for others have similar issue :
looks like there is a workaround that solves my issue
As a workaround, add the following code to .csproj:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy $(OutDir)$(ProjectName).deps.json $(OutDir)bin\function.deps.json" />
</Target>
<Target Name="PostPublish" BeforeTargets="Publish">
<Exec Command="copy $(PublishDir)$(ProjectName).deps.json $(PublishDir)bin\function.deps.json" />
</Target>
Another fix is to move from Microsoft.NET.Sdk.Functions" Version="3.0.8" back to 3.0.7
Reference: https://github.com/Azure/Azure-Functions/issues/1370#issuecomment-654698010
I am working through a tutorial on .Net core apps and Visual Studio Code, and cannot add a package to the app.
Using the CLI I did:
dotnet new console
dotnet run
Which worked fine.
Then I run:
dotnet add package System.Net.Http
And got this result:
$ dotnet add package System.Net.Http
Writing C:\Users\xxx\AppData\Local\Temp\tmpF935.tmp
info : Adding PackageReference for package 'System.Net.Http' into project 'C:\Visual Studio Code\learning-module\learning-module.csproj'.
log : Restoring packages for C:\Visual Studio Code\learning-module\learning-module.csproj...
error: Unable to resolve 'System.Net.Http ' for '.NETCoreApp,Version=v2.2'.
error: Package 'System.Net.Http' is incompatible with 'all' frameworks in project 'C:\Visual Studio Code\learning-module\learning-module.csproj'.
I've tried manually adding the package to the project file and running restore; changing the target framework; running from the console rather than Visual Studio Code; and trying different common packages, but nothing seems to resolve.
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.103
Commit: 8edbc2570a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.103\
Host (useful for support):
Version: 2.2.1
Commit: 878dd11e62
.NET Core SDKs installed:
2.1.503 [C:\Program Files\dotnet\sdk]
2.2.103 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Does anyone know what else I could try or how to find out more info on this issue?
System.Net.Http is a standard namespace in .Net Core 2. You shouldn't need to add an external package.
Just put a using statement at the top of your code:
using System.Net.Http;
I'm trying to install OEPE from the site:
http://download.oracle.com/otn_software/oepe/ganymede
But I get the following error:
Cannot complete the install because one or more required items could not be found.
Software being installed: Oracle Common Tools 1.1.1.200904131333 (com.oracle.tools.eclipse.ganymede.common.feature.feature.group 1.1.1.200904131333)
Missing requirement: Oracle Common Tools 1.0.1.200904131333 (oracle.eclipse.tools.common 1.0.1.200904131333) requires 'bundle org.eclipse.jdt.core [3.4.2,3.5.0)' but it could not be found
Cannot satisfy dependency:
From: Oracle Common Tools 1.1.1.200904131333 (com.oracle.tools.eclipse.ganymede.common.feature.feature.group 1.1.1.200904131333)
To: oracle.eclipse.tools.common [1.0.1.200904131333]
Version information:
Eclipse Java Development Tools
Version: 3.5.0.v20090527-2000-7r88FEeFJePyvYeA33DjZ_c1
Build id: I20090611-1540
From the error:
requires 'bundle org.eclipse.jdt.core [3.4.2,3.5.0)'
This means 3.4.2 inclusive to 3.5.0 exclusive, so it appears the version of the Oracle plugin will not work with Eclipse 3.5, try it with a 3.4 version of Eclipse (from 3.4.2 onwards).
You have a version for Eclipse 3.4.
Oracle also has a technology preview for 3.5 that you could try instead.