OS: Windows 10 Enterprise 10.0.18362
IDE: Visual Studio 2019 Community Edition Version 16.3.6
NET Core version: 3.0.100 Commit: 04339c3a26
What to do: Create simple .NET Core 3 console app in VS2019, switch target platform to x86 and press "F5".
Then 2 options:
.NET Core 3 any versions installed in system (all combinations of x86, x64, both). Environment variable "path" for x86 moved up and "dotnet --info" shows that it targets x86 version:
Error: The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
The program '[18492] dotnet.exe' has exited with code -2147450751 (0x80008081).
P.S. In this case this error also shown when switched to x64 target platform. But everything works good when run as AnyCPU.
Any version of .NET Core installed and environment variable for x86 version removed of moved below x64 version
Error: IDE can't find x86 version of dotnet.exe in Program Files (x86)
Infos for both x86 and x64 versions of dotnet:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x86
Base Path: C:\Program Files (x86)\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
3.0.100 [C:\Program Files (x86)\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.1.509 [C:\Program Files\dotnet\sdk]
2.2.103 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [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.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Have to say that x86 version of compiled console app works good if you launch exe file. Just can't launch it in debug from VS 2019. If switch to AnyCPU/x64
I am also using Visual Studio 2019 (16.3.8) and got a similar error when trying to debug with target x86 (but a netcoreapp2.0 project):
C:\Program Files\dotnet\dotnet.exe (process 40168) exited with code -532462766.
To automatically close the console when debugging stops, enable Tools->Options-
>Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
If I remember right, this was working out of the box with Visual Studio 2017 and after installing VS 2019, VS 2017 also started to behave the same. It's ridiculous that VS cannot detect the target platform and launch the correct dotnet.exe accordingly.
Fortunately the fix is quite easy, add this setting to your project:
<PropertyGroup>
<RunCommand Condition=" '$(Platform)' == 'x86' ">$(MSBuildProgramFiles32)\dotnet\dotnet</RunCommand>
</PropertyGroup>
So when debugging, if your current target is x86, it will use C:\Program Files (x86)\dotnet\dotnet.exe and for others (default setting) it will use C:\Program Files\dotnet\dotnet.exe
Of course you should first ensure you have a .NET Core X86 SDK.
For a more detailed setting (more conditions), see here:
https://github.com/dotnet/cli/issues/7532#issuecomment-330706524
Though, the simple setting above works well for debugging both x86 and AnyCPU.
for me happend the same error, was because the parent folder name was "c#" and another folder inside of it that contains the c# project, the name was "month 9", so i renamed it the "c#" folder to "csharp" and the "month 9" to "month9" and then a ran the project again and worked it.
example with error:
c# >
month 9 >
"project here"
example fixed:
csharp >
month9 >
"project here"
Related
I am on Windows 10, I had dotnet core 3.1, but I also have now dotnet core 5, apparently from an update. I noticed that dotnet applications ran more slowly, e.g.:
I open PowerShell in a new map, and do:
dotnet new console
dotnet build
measure-command { dotnet run }
I get this output:
Days : 0
Hours : 0
Minutes : 0
Seconds : 10
Milliseconds : 617
Ticks : 106172423
TotalDays : 0.000122884748842593
TotalHours : 0.00294923397222222
TotalMinutes : 0.176954038333333
TotalSeconds : 10.6172423
TotalMilliseconds : 10617.2423
10 seconds seems slow.
I re-installed dotnet core 3.1
If I open a new map, first add a global.json like this:
{
"sdk": {
"version": "3.1.416",
"rollForward": "disable"
}
}
and then do the same commands, I still get about 10 seconds. How can this be so slow?
dotnet --info says:
.NET Core SDK (reflecting any global.json):
Version: 3.1.416
Commit: 8d3765c609
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.416\
Host (useful for support):
Version: 5.0.13
Commit: b3afe99225
.NET SDKs installed:
3.1.416 [C:\Program Files\dotnet\sdk]
5.0.404 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
According to this answer:
What is the meaning of 'Host (useful for support)' in output of 'dotnet --info'
the dotnet.exe is from version 5, but it should be smart enough to behave like 3.1.
What can I do about this?
Update:
Problems are probably caused because my CPU is behaving badly. I used (CPU-Z) benchmark to compare.
cpu comparison
So I need to repare that first.
Update:
It was the CPU. It was running at 25% because it was incorrectly sensing a high temperature and went to a save operating mode.
Solution: Turn off the laptop, remove the battery, wait for some time.
Output from dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 3.1.416
Commit: 8d3765c609
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.416\
Host (useful for support):
Version: 5.0.13
Commit: b3afe99225
.NET SDKs installed:
3.1.416 [C:\Program Files\dotnet\sdk]
5.0.404 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
What does 'Host (useful for support) Version 5.0.13' mean here?
I have a global.json to specify that I want to use 3.1.416:
global.json:
{
"sdk": {
"version": "3.1.416",
"rollForward": "disable"
}
}
But this 'Host (useful for support)' seems to indicate that I am using 5.0.13 after all.
So, you already knew that on a single machine multiple .NET Core SDK can be installed, like 3.1 and 5.0 on yours.
They both install to a common place C:\Program Files\dotnet\sdk, but there is a single dotnet.exe executable, which usually comes from the newest .NET Core SDK installation, which is the "Host" in your context.
When you set the desired SDK version in global.json, the 5.0 Host is smart enough to redirect all actual commands (like dotnet build) to utilize the 3.1 SDK bits.
I'm running on a macOS and the project I'm working on just upgraded from .NET Core 2 to .NET Core 3. The problem is that I can no longer build my project in Rider. If I try to build it in the terminal using dotnet build, the build succeeds. In my project, there are some subprojects that use netstandard2, but this should not be a problem (as its working in the terminal). I'm getting the following error message:
Project1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Project2 supports: netstandard2.1 (.NETStandard,Version=v2.1)
I have tried to add a global.json file which specifies I'm using version 3 of .NET Core, but it didn't help.
If I'm running dotnet build once in the terminal, then the new build of Rider will succeed. So things are working, but it is just annoying to always build in the terminal first.
The output of dotnet --info:
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100/
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.2.300 [/usr/local/share/dotnet/sdk]
2.2.401 [/usr/local/share/dotnet/sdk]
2.2.402 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I found that the issue was in Rider. The workaround is to change PackageReference Restore Engine (in File > Settings > Build, Execution, Deployment > NuGet) to MSBuild.
The issue will be fixed in a later version of Rider, so it is recommended to switch back to Embedded after the version is relased. The difference between MSBuild and Embedded:
MSBuild just calls external MSBuild task; Embedded directly calls
NuGet API inside Rider process. Embedded should work much faster and
it provides additional logs which can be useful when restore fails
The reason for the issue:
[...] because Rider 2019.2 EAP2 still used NuGet 4.9 internally; this
version doesn't have proper support of .NET Core 3.0 / .NET Standard
2.1. In Rider 2019.2 RTM, we are going to upgrade the internal version of NuGet up to 5.1.
Source for quotes and screenshot:
https://youtrack.jetbrains.com/issue/RIDER-29888
I have a .NET Sdk version 2.1 and lower.
I installed sdk2.2 and sdk3.
I removed sdk3
Now, the VS17 build and test my solution successfully.
But from the command line, with dotnet-cli, I can't compile the solution, because he says he is sdk2.1.
dotnet build:
C:\Program Files\dotnet\sdk\2.1.500\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. [C:\Users\.......\WebApi.csproj]
Build FAILED.
dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 2.2.104
Commit: 73f036d4ac
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.104\
Host (useful for support):
Version: 2.2.2
Commit: a4fd7b2c84
.NET Core SDKs installed:
2.1.500 [C:\Program Files\dotnet\sdk]
2.2.104 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
WebApi.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
.
.
.
</PropertyGroup>
</Project>
Thanks to livarcocc, we know the issue is in MSBuildSDKsPath environment variable, who still points to sdk2.1.
For fix the problem, we need to retarget the MSBuildSDKsPath to the SDK version we want, or completely remove this variable.
Before:
set MSBuildSDKsPath
MSBuildSDKsPath=C:\Program Files\dotnet\sdk\2.1.500\Sdks
After:
set MSBuildSDKsPath
MSBuildSDKsPath=C:\Program Files\dotnet\sdk\2.2.104\Sdks
I don't really understand what is the difference between the dotnet sdk version and the TargetFramework version specified in my csproj file.
For example, my current project is using <TargetFramework>netcoreapp2.1</TargetFramework> version, but dotnet --version command returns 2.2.100. So the major version is the same, but the minor differs by 1.
Is it backwards compatible and netcoreapp2.1 apps can run on newer versions of dotnet sdk or something completely different?
dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 2.2.100
Commit: b9f2fa0ca8
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.100\
Host (useful for support):
Version: 2.2.0
Commit: 1249f08fed
.NET Core SDKs installed:
2.2.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download