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!
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With