Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETSDK1124 - Error when building on MacOS #945

Open
acovaci opened this issue Apr 10, 2024 · 2 comments
Open

NETSDK1124 - Error when building on MacOS #945

acovaci opened this issue Apr 10, 2024 · 2 comments

Comments

@acovaci
Copy link

acovaci commented Apr 10, 2024

Describe the bug
Hi, obligatory I'm not used to C#/.NET dev at all :).

I'm trying to build the project on MacOS. The windows build seems to work fine, but for the Linux build I run into the following issue:

Compiling installer for linux...
-------------------------------------------------
MSBuild version 17.9.8+b34f75857 for .NET
  Determining projects to restore...
/usr/local/share/dotnet/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. [/Users/######/Documents/Projects/SMAPI/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj::TargetFramework=netstandard2.0]
/usr/local/share/dotnet/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. [/Users/######/Documents/Projects/SMAPI/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj::TargetFramework=netstandard2.0]

To Reproduce

  1. Fresh clone of the repo
  2. Set the game path in build/unix/prepare-install-packages.sh in the $gamePath variable
  3. ./build/unix/prepare-install-packages.sh

What I tried so far

I tried changing the TargetFramework to core3.0, but ran into new errors.

Does anyone have a working reproducible setup to build for MacOS? Thanks

@acovaci
Copy link
Author

acovaci commented Apr 10, 2024

Okay so while waiting for a reply from people more knowledgable than me, after a bit of googling, I found out I can create a global.json in the root with:

{
    "sdk": {
        "version": "6.0.100",
        "rollForward": "patch"
    }
}

Now the error disappears, but I'm running into a whole new issue:

/Users/######/Documents/Projects/SMAPI/src/SMAPI/Framework/Logging/VerboseLogStringHandler.cs(24,16): error CS0171: Field 'VerboseLogStringHandler.Handler' must be fully assigned before control is returned to the caller [/Users/######/Documents/Projects/SMAPI/src/SMAPI/SMAPI.csproj]

I tried with both 6.0.1xx and 6.0.4xx with no luck. Meanwhile, 6.0.0 has no M1-compatible SDK.

@acovaci
Copy link
Author

acovaci commented Apr 10, 2024

Okay so now I am able to debug, but running into this:

/Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/StardewModdingAPI 
Failed to load /Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/libhostfxr.dylib, error: dlopen(/Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/libhostfxr.dylib, 0x0001): tried: '/Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/libhostfxr.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/libhostfxr.dylib' (no such file), '/Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/libhostfxr.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
The library libhostfxr.dylib was found, but loading it from /Users/######/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366

EDIT: Just to clarify, this is now using Visual Studio for Mac, and .NET 6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant