dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

[macOS] dotnet publish cannot write pkg file #24348

Open xperiandri opened 2 years ago

xperiandri commented 2 years ago

Description

When I call dotnet publish -f net6.0-macos /p:_platformName=macOS -r osx-x64 I get error productbuild directory "bin/Release/net6.0-macos/osx-x64/publish" does not exist for writing "Transmission.Client.Mobile-1.0.pkg".

Reproduction Steps

  1. Create Uno Platform app .NET 6 from template
  2. Add <TargetFrameworks Condition="'$(_PlatformName)' == 'macOS'">net6.0-macos</TargetFrameworks> to Mobile.csproj
  3. Call dotnet publish -f net6.0-macos /p:_platformName=macOS -r osx-x64

Expected behavior

pkg file creates successfully

Actual behavior

Error productbuild directory "bin/Release/net6.0-macos/osx-x64/publish" does not exist for writing "Transmission.Client.Mobile-1.0.pkg".

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

I suppose that command line arguments are incorrect CommandLineArguments = /usr/bin/productbuild --product /Users/xperiandri/Projects/ITM/Client/Client.Mobile/obj/Release/net6.0-macos/osx-x64/Product.plist --component bin/Release/net6.0-macos/osx-x64/publish/Transmission.Client.Mobile.app /Applications bin/Release/net6.0-macos/osx-x64/publish/Transmission.Client.Mobile-1.0.pkg

And the path bin/Release/net6.0-macos/osx-x64/publish/Transmission.Client.Mobile-1.0.pkg is calculated not from csproj file but from some other path

t.macOS.binlog.zip

dotnet-issue-labeler[bot] commented 2 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

Juriyx commented 2 years ago

Also /p:OutDir is not taken into account Instead of /p:OutDir=$(build.binariesdirectory)/$(BuildConfiguration) which expand to /p:OutDir=/Users/runner/work/1/b/Release used an expanded path to the default location relative to csproj /Users/runner/work/1/a/../s/Client/Client.Mobile/bin/Release/net6.0-macos/osx-x64/Transmission.Client.Mobile.app/Contents/MacOS//Transmission.Client.Mobile

Normal.txt Verbose.zip

Juriyx commented 2 years ago

What I wanted to achive is that [command]/Users/runner/hostedtoolcache/dotnet/dotnet publish /Users/runner/work/1/s/Client/Client.Mobile/Transmission.Client.Mobile.csproj -v:n -f net6.0-macos --no-restore /p:_PlatformName=macOS -c Release /p:OutDir=/Users/runner/work/1/b/Release -o /Users/runner/work/1/a /p:BuildProjectReferences=false

binaries appear in /p:OutDir=/Users/runner/work/1/b/Release binaries directory and a pkg installer in -o /Users/runner/work/1/a artifacts directory

TanayParikh commented 2 years ago

I'm seeing this as well with Maui Blazor Hybrid:

dotnet publish -f net6.0-maccatalyst -c Release