I have an application targeting dotnet 5.0.* which I publish using the command line. I've used Visual Studio 2019 with dotnet 5.0.* SDK installed and publishing worked fine on that.
But, I recently installed Visual Studio 2022 Preview, and tried running dotnet publish
command, it failed due to the preview sdk. See the console error message I'm getting below.
I have searched most of MSDN docs on how to specify dotnet version while publishing a dotnet app, but could not find a solution.
I am using the powershell scripts below:
$version = "6.12.0"
$product = "CrystalERP"
$project = "I:\CrystalRelease\crystal.erp\crystal.pos.cafe\Crystal.Pos.Cafe.csproj"
$output = "I:\App"
$dotnet = "C:\Program Files\dotnet\dotnet.exe"
$runtimes = @(
"linux-x64"
)
# clear previous releases
Remove-Item "$output\App*" -Recurse -Confirm:$true
$runtimes | %{
& $dotnet publish $project -c release -r $_ -o ("{0}\{1}" -f $output,"App")