1 year ago

#384139

test-img

Ethan Seal

Dotnet publish command seemingly ignores the framework argument

I am attempting to build and publish a .NET Framework 4.7.2 project. The build works fine, but attempting to publish gives me the following error:

C:\Program Files\dotnet\sdk\6.0.201\Microsoft.Common.CurrentVersion.targets(4466,5): error : MSB4803: The task "FormatUrl" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See https://aka.ms/msbuild/MSB4803 for further details. [C:\Users\ethanseal\Documents\compute-hybridrp\src\EV2Linter\EV2Linter.csproj]
Start-WindowsBuild : Encountered an error during dotnet publish C:\Users\ethanseal\Documents\xxxxxxx\Linter.sln -o
C:\Users\ethanseal\Documents\xxxxxxx\Linter --no-build
At C:\Users\ethanseal\Documents\xxxxxxx\build\build-win.ps1:63 char:1
+ Start-WindowsBuild
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-WindowsBuild

Here's the command I used:

& dotnet publish $solution -o $outPath -f net472 --no-build

You can see that I included an argument to specify the .NET Framework 4.7.2 framework. So why is it defaulting to .NET Core 6.0? Additionally, the project has a target framework of 4.7.2.

c#

.net

powershell

.net-core

.net-4.0

0 Answers

Your Answer

Accepted video resources