Trying to create a build script using Psake on .Net Core 3 projects on Mac.
Invoking Psake with a specific framework,
Invoke-psake -buildFile default.ps1 `
-taskList Test `
-framework netcoreapp3.0 `
-properties @{
"buildConfiguration" = "Release"
"buildPlatform" = "Any CPU"} `
-parameters @{
"solutionFile" = "PaymentGateway.sln"}
and use msbuild for the solution.
Exec {
msbuild $SolutionFile "/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir=$temporaryOutputDirectory"
}
It doesn't compile. It seems to use 'mono msbuild', looking at the error message.
"/Users/jakeryu/RiderProjects/PaymentGateway/PaymentGateway.sln" (default target) (1) -> "/Users/jakeryu/RiderProjects/PaymentGateway/Bank/Bank.csproj" (default target) (8) -> /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [/Users/jakeryu/RiderProjects/PaymentGateway/Bank/Bank.csproj]
I have runtime and SDK installed for dotnetcore3 as below, and the current version is 3.0.100.
dotnet --version 3.0.100
I can't figure out why msbuild comes from the mono framework rather than .net core. Is there a way to specify which msbuild should be used on Mac?
You can use dotnet msbuild
as a drop-in replacement for msbuild
to definitely use the MSBuild version coming with .NET Core.