Configure .NET Core to use the x86 SDK

I am 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 see this 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 the .NET Core SDK version 1.0.0-preview2-003131, which is not installed or cannot be found on the path C: \ Program Files \ dotnet. These components are required to create and run this project. Download the .NET Core SDK version specified in global.json, or upgrade the SDK version in global.json to the installed version.

I think I need to tell my application to look in C: \ Program Files (x86) \ dotnet

How to do it?

Thanks for any help!

+4
4

.

x64, PATH C:\Program Files\dotnet. x64 x86. , x64 C:\Program Files\dotnet PATH. , , , x86, C:\Program Files (x86)\dotnet .

+5

- PATH. 64- Visual Studio .

+1

The issue is known once previous versions have been removed

Install this based on the correct version version and target platform

+1
source

You can solve this problem by creating a file Directory.Build.targetsin the root directory 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 that both SDKs (x64, x86) are installed, the compiler will find the correct platform, as indicated in the build settings of your project.

0
source

Source: https://habr.com/ru/post/1654610/


All Articles