Reputation: 3856
I'm trying to change my .NET Core Web Application to use the x86 version of the .NET Core SDK.
I installed the x86 version from here. I can see it in C:\Program Files (x86)\dotnet\sdk\1.0.0-preview2-003131
I updated my global.json to this:
{
"projects": [ "src" ],
"sdk": {
"version": "1.0.0-preview2-003131",
"architecture": "x86"
}
}
But I get the error:
The project is configured to use .NET Core SDK version 1.0.0-preview2-003131 which is not installed or cannot be found under the path C:\Program Files\dotnet. These components are required to build and run this project. Download the version of .NET Core SDK specified in global.json or update the SDK version in global.json to the version that is installed.
I guess I need to tell my application to look in C:\Program Files (x86)\dotnet
How do I do this?
Thanks for any help!
Upvotes: 8
Views: 7052
Reputation: 11
Incase it will help somebody, I am going to explain the solution. Go to control panel -> write in the search environmental variables -> edit the system environmental variables -> environmental variables -> system variables -> Path and press edit.
Once you there, move "C:\Program Files\dotnet" bellow "C:\Program Files (x86)\dotnet".
restart your terminal and it should work
Upvotes: 1
Reputation: 1032
You can sort out this issue by creating a Directory.Build.targets
file in the root of your project.
<Project>
<PropertyGroup
Condition="'$(OS)' == 'Windows_NT' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
'$(SelfContained)' != 'true'"
>
<RunCommand Condition="'$(PlatformTarget)' == 'x86'">$(MSBuildProgramFiles32)\dotnet\dotnet</RunCommand>
<RunCommand Condition="'$(PlatformTarget)' == 'x64'">$(ProgramW6432)\dotnet\dotnet</RunCommand>
</PropertyGroup>
</Project>
Now, with both SDKs installed (x64, x86), the compiler will find the correct platform, as specified in your project build settings.
Upvotes: 3
Reputation: 7429
The issue is known, once the previous versions have been uninstalled
The install this based on the correct release version and target platform
Upvotes: 1
Reputation:
For some reason, my install didn't even add the PATH variable. Adding the 64-bit path variable and restarting visual studio worked for me.
Upvotes: 1
Reputation: 3856
Found the solution.
When I installed the x64 version, it created an entry in my PATH environment variable called C:\Program Files\dotnet. I uninstalled the x64 version and installed the x86 version. However, the un-installation of the x64 version did not remove the C:\Program Files\dotnet from my PATH. So, I removed it manually, and made sure that the entry that the x86 version added, C:\Program Files (x86)\dotnet, existed.
Upvotes: 6