Create an empty project and set it to a macos target (e.g. net7.0-macos10.15) with a basic plist file
run dotnet build ProjectName -r osx-arm64 -p:PublishSingleFile=true -p:UseAppHost=true
I've been able to reproduce with both net6 and net7 running on an M2 Macbook. Building for arm64/x64 doesn't make a difference. Using publish instead of build doesn't make a difference. Without PublishSingleFile it generates an .app bundle as expected.
Expected Behavior
The build should succeed and generate an .app bundle with a single-file binary. (My goal is to generate both x64 and arm64 single-file binaries so I can lipo them into a universal binary.)
Actual Behavior
/usr/local/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(904,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [/Users/ben/Devel/SingleFileBug/SingleFileBug/SingleFileBug.csproj]
/usr/local/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(904,5): error MSB4018: System.ArgumentException: Invalid input specification: Must specify the host binary [/Users/ben/Devel/SingleFileBug/SingleFileBug/SingleFileBug.csproj]
/usr/local/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(904,5): error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [/Users/ben/Devel/SingleFileBug/SingleFileBug/SingleFileBug.csproj]
Environment
Version information
```
Visual Studio Community 2022 for Mac
Version 17.4 (build 2406)
Installation UUID: d229a3ed-4553-4512-bbbc-9a86d9895e31
Runtime
.NET 6.0.9 (64-bit)
Architecture: Arm64
Xamarin Designer
Version: 17.4.0.136
Hash: d49c9ff6d3
Branch: remotes/origin/d17-4
Build date: 2022-11-02 23:47:17 UTC
Roslyn (Language Service)
4.4.0-3.22461.4+8ab250290a4010c11a21521f78dbc87dbb7aac81
NuGet
Version: 6.3.1.1
.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/7.0.100/Sdks
SDK Versions:
7.0.100
7.0.100-preview.7.22377.5
6.0.403
6.0.400
6.0.302
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET SDK (x64)
SDK Versions:
7.0.100-preview.7.22377.5
6.0.403
6.0.302
4.1.425
3.1.422
3.1.421
.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
7.0.0
7.0.0-preview.7.22375.6
6.0.11
6.0.8
6.0.7
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
7.0.0-preview.7.22375.6
6.0.11
6.0.7
5.0.17
3.1.31
3.1.28
3.1.27
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Apple Developer Tools
Xcode 14.0 (21322)
Build 14A5284g
Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400
Xamarin.iOS
Version: 16.0.0.72 (Visual Studio Community)
Hash: 6756a1146
Branch: release/6.0.4xx-xcode14
Build date: 2022-09-21 08:51:06-0400
Xamarin.Android
Not Installed
Microsoft Build of OpenJDK
Java SDK: Not Found
Eclipse Temurin JDK
Java SDK: Not Found
Android SDK Manager
Version: 17.4.0.54
Hash: 6eabb9e
Branch: remotes/origin/d17-4
Build date: 2022-11-02 23:47:26 UTC
Android Device Manager
Version: 0.0.0.1206
Hash: 886af39
Branch: 886af39
Build date: 2022-11-02 23:47:26 UTC
Build Information
Release ID: 1704002406
Git revision: dfb45c1152306f0d5f77334f9d026b0aadb7ec90
Build date: 2022-11-02 23:44:22+00
Build branch: release-17.4
Build lane: release-17.4
Operating System
Mac OS X 13.0.1
Darwin 22.1.0 Darwin Kernel Version 22.1.0
Sun Oct 9 20:15:52 PDT 2022
root:xnu-8792.41.9~2/RELEASE_ARM64_T8112 arm64
```
Steps to Reproduce
dotnet build ProjectName -r osx-arm64 -p:PublishSingleFile=true -p:UseAppHost=true
I've been able to reproduce with both net6 and net7 running on an M2 Macbook. Building for arm64/x64 doesn't make a difference. Using
publish
instead ofbuild
doesn't make a difference. Without PublishSingleFile it generates an .app bundle as expected.Expected Behavior
The build should succeed and generate an .app bundle with a single-file binary. (My goal is to generate both x64 and arm64 single-file binaries so I can
lipo
them into a universal binary.)Actual Behavior
Environment
Version information
``` Visual Studio Community 2022 for Mac Version 17.4 (build 2406) Installation UUID: d229a3ed-4553-4512-bbbc-9a86d9895e31 Runtime .NET 6.0.9 (64-bit) Architecture: Arm64 Xamarin Designer Version: 17.4.0.136 Hash: d49c9ff6d3 Branch: remotes/origin/d17-4 Build date: 2022-11-02 23:47:17 UTC Roslyn (Language Service) 4.4.0-3.22461.4+8ab250290a4010c11a21521f78dbc87dbb7aac81 NuGet Version: 6.3.1.1 .NET SDK (Arm64) SDK: /usr/local/share/dotnet/sdk/7.0.100/Sdks SDK Versions: 7.0.100 7.0.100-preview.7.22377.5 6.0.403 6.0.400 6.0.302 MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks .NET SDK (x64) SDK Versions: 7.0.100-preview.7.22377.5 6.0.403 6.0.302 4.1.425 3.1.422 3.1.421 .NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 7.0.0 7.0.0-preview.7.22375.6 6.0.11 6.0.8 6.0.7 .NET Runtime (x64) Runtime: /usr/local/share/dotnet/x64/dotnet Runtime Versions: 7.0.0-preview.7.22375.6 6.0.11 6.0.7 5.0.17 3.1.31 3.1.28 3.1.27 Xamarin.Profiler Version: 1.8.0.19 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Apple Developer Tools Xcode 14.0 (21322) Build 14A5284g Xamarin.Mac Version: 8.12.0.2 (Visual Studio Community) Hash: 87f98a75e Branch: d17-3 Build date: 2022-07-25 20:18:54-0400 Xamarin.iOS Version: 16.0.0.72 (Visual Studio Community) Hash: 6756a1146 Branch: release/6.0.4xx-xcode14 Build date: 2022-09-21 08:51:06-0400 Xamarin.Android Not Installed Microsoft Build of OpenJDK Java SDK: Not Found Eclipse Temurin JDK Java SDK: Not Found Android SDK Manager Version: 17.4.0.54 Hash: 6eabb9e Branch: remotes/origin/d17-4 Build date: 2022-11-02 23:47:26 UTC Android Device Manager Version: 0.0.0.1206 Hash: 886af39 Branch: 886af39 Build date: 2022-11-02 23:47:26 UTC Build Information Release ID: 1704002406 Git revision: dfb45c1152306f0d5f77334f9d026b0aadb7ec90 Build date: 2022-11-02 23:44:22+00 Build branch: release-17.4 Build lane: release-17.4 Operating System Mac OS X 13.0.1 Darwin 22.1.0 Darwin Kernel Version 22.1.0 Sun Oct 9 20:15:52 PDT 2022 root:xnu-8792.41.9~2/RELEASE_ARM64_T8112 arm64 ```Build Logs
msbuild.binlog.zip
Example Project (If Possible)
SingleFileBug.zip