NETSDK1061 version mismatch error after update
See original GitHub issueI recently upgraded my Ubuntu packages (I saw some dotnet packages were updated during this), and now when I start VS Code I have a OmniSharp error:
[fail]: OmniSharp.MSBuild.ProjectLoader
NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.5, but with current settings, version 3.0.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 can still build & run normally, both from IDE and command line.
I have also tried a restore from command line, and it did not seem to fix the issue.
I don’t think I was having this issue before updating the system packages.
Environment data
.NET Core SDK (reflecting any global.json):
Version: 3.1.401
Commit: 39d17847db
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.401/
Host (useful for support):
Version: 3.1.7
Commit: fcfdef8d6b
.NET Core SDKs installed:
2.1.809 [/usr/share/dotnet/sdk]
3.1.401 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
VS Code version: 1.47.3 C# Extension version: 1.22.1
OmniSharp log
Starting OmniSharp server at 8/11/2020, 7:22:27 PM
Target: /project/hatch
OmniSharp server started.
Path: /home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/run
PID: 16818
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on ubuntu 18.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.4 - "/home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.4 - "/home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/sky/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/project/hatch'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/project/hatch'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/project/hatch/hatch.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/project/hatch'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /project/hatch/hatch.csproj
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/project/hatch' on host 16060.
[fail]: OmniSharp.MSBuild.ProjectLoader
NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.5, but with current settings, version 3.0.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.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/project/hatch/hatch.csproj'.
/project/hatch/hatch.csproj
/project/hatch/hatch.csproj(0,0): Error: NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.5, but with current settings, version 3.0.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.
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: /project/hatch/hatch.csproj
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
NETSDK1061 error when publishing for runtime
I see you are setting TargetFramework as an environment variable. MSBuild turns environment variables into properties. I think this is what is causing...
Read more >.NET SDK error list - .NET CLI | Microsoft Learn
NET 6 SDK and later versions. This is a complete list of the errors that you might get from the .NET SDK while...
Read more >Nuget Version Mismatch Error occurs in two Solutions [duplicate]
When it tries to update, it says that another package is not compatible with the newer version! What is the correct method of...
Read more >NET Core - Project version mismatch - Matt Fantinel
This problem usually happens when you're working on a solution with multiple projects that were created using different versions of the .NET SDK ......
Read more >Hack to Fix the Version Mismatch Error on NA - Reddit
I agree completely, thus the "Eh, just pick a server". DNS is one of those systems that could be done better, but good...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pyrrho Issues with using the latest .NET Core SDK with our included Mono should be resolved in this pre-release - https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.23.0
I think I’m having an issue similar to @michellamin and @sky-lake. I upgraded from 3.1.300 to 3.1.401 and vscode began showing numerous errors in code that don’t prevent the CLI from correctly building and testing the project. (The errors are somewhat nonsensical;
The type 'Enum' is defined in an assembly that is not referenced.
) Looking through the logs, I saw theMicrosoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found
error, which is how I wound up here.Downgrading to 3.1.302 seems to “fix” the omnisharp extension, in that the spurious errors are no longer generated.
Here’s the interesting part. The
Microsoft.Build.Exceptions.InvalidProjectFileException:
error is still emitted in vscode’s OmniSharp logs when using 3.1.302.Perhaps Microsoft has been playing with its package layout, moved the SDK a few version back, and just recently moved the
System
,System.Void
, etc. packages into that misplaced SDK?