xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.44k stars 509 forks source link

Building a dotnet new iOS app on the command line on a Mac fails with a Windows path in the nuget.config file #20800

Closed brunck closed 2 months ago

brunck commented 2 months ago

It's helpful to have a nuget.config file on the Windows side to shorten paths, due to the dastardly max path problem in VS for Windows. This breaks building the project on a Mac at the command line.

Building the same project in VS for Windows (paired to a Mac) works.

Steps to Reproduce

  1. dotnet new ios -n someName on a Mac
  2. Create a nuget.config file for the created project with a Windows path like C:\n for example:
    <configuration>
    <config>
    <add key="globalPackagesFolder" value="C:\n" />
    </config>
    </configuration>
  3. dotnet build
  4. or, just download and run the provided example project

Expected Behavior

The app builds with no errors.

Actual Behavior

A Failed to create CoreCLR, HRESULT: 0x80070057 error, along with a message about setting the PublishTrimmed property to false, which is disallowed in a.NET for iOS app anyway

Environment

Version information .NET SDK version 8.0.302 Workload info: `ios 17.2.8053/8.0.100 SDK 8.0.300`

Example Project (If Possible)

https://github.com/brunck/reproductions/tree/master/NuGetConfigBuildError

rolfbjarne commented 2 months ago

This looks like a bug in .NET:

$ mkdir rootdir
$ cd rootdir
$ dotnet new console
[...]
$ dotnet publish /p:PublishDir=C:
[...]
$ dotnet exec C:/rootdir.dll
Failed to create CoreCLR, HRESULT: 0x80070057
rolfbjarne commented 2 months ago

Looks like variations of https://github.com/dotnet/runtime/issues/3163 and https://github.com/dotnet/runtime/issues/75387

rolfbjarne commented 2 months ago

This issue was moved to dotnet/runtime#104402