0
votes

We developed an a .NET Core Web API application using the following technologies:

-NET Core (3.1)

-Visual Studio 2019

Unfortunately, we have to deploy said application to the following environment:

-32-bit Environment

-Windows Server 2008 R2 Enterprise (Service Pack 1)

-IIS Version 7.5

-8 GB RAM

( Also, it needs to be an In-Process because we Only want the .NET Core Web API Application to be within IIS Server )*

On my Development Computer that uses Visual Studio 2019, I installed Net Core 3.1 x86 sdk version ( i.e., the .NET Core 32-Bit version )

Prior to Visual Studio 2019's Build, we have to specify Platform target: "Any CPU" because if we specified "x86" then when we deploy to our IIS Server x86 platform, it throws a weird 500 level error when we run the .NET Core Web API in IIS.

enter image description here

We are trying to use dotnet commandline to publish the .NET Core Web API application.

D:\AppCodeArena\BlahBlahProject>dotnet publish -c Release /p:Platform:"Any CPU" /p:EnvironmentName=UAT BlahBlahProject.csproj --output D:\IISDeployment\Uploader.BlahBlahProject

Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1006: Property is not valid. Switch: Platform:Any CPU

Unfortunately, it states above that

/p:Platform:"Any CPU"

is invalid? Could someone please post the correct dotnet publish... command that will allow use to specify "Any CPU" for the platform?

Or if there is anyway to use MSBuild commandline instead of "dotnet publish" commandline then could someone please post how to do so?

2

2 Answers

1
votes

I can get it work with

dotnet publish /p:Configuration=Release /p:Platform="Any CPU" /p:EnvironmentName=Myproject.csproj --output D:\IISDeployment\Uploader.BlahBlahProject

enter image description here When I use -c -release, it just fail.

enter image description here

Update:

dotnet publish /p:Configuration=Release /p:Platform="Any CPU" /p:EnvironmentName="UAT" BlahBlahProject.csproj --output DIISDeploymentUploader.BlahBlahProject
0
votes

Build parameters are passed to msbuild via the dotnet command using the following syntax:

/p:Platform="Any CPU"

Notice the = rather than the : you use in your command.