2

In Jetbrains Rider, the Build Configurations let you change some of the parameters passed in when the Build Project command is invoked, but there's nowhere I can find to enter the specific Runtime Identifier.

The reason we'd like to provide a specific identifier, is because one of the project dependencies use native libraries that if the runtime is not specified, it outputs those libraries into a "runtimes" folder with all the targets inside, and when the project runs, it doesn't know how to load the proper one. By specifying a runtime, only the native libraries for that runtime are going to be copied directly into the output bin folder.

We are currently resorting to build the project through the command line using dotnet build -r osx-x64 MyProject.csproj, and then running the project through Rider, but that is not a good developer experience.

The question, is there a configuration in Rider that we can specify the runtime that's going to be passed into the dotnet build command when the Build is invoked through the menu, or Key Bindings?

The specific project in this case is an C# Azure Functions project, but it also applies to regular Console projects as well.

Expecting to have a way to define custom build arguments for projects

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
  • You can always specify RID in the .csproj file. – Guru Stron Jul 13 '23 at 18:18
  • We can, but we were trying to avoid that since it's going to be checked into source control and there's a mixture of different runtimes among the developers, some devs are on Windows, others in MacOS x64, ARM64, and the the target runtime for prod builds is linux. – user19721505 Jul 13 '23 at 18:26

1 Answers1

2

If you do not want to specify it in .csproj you can use the Toolset and Build settings (File -> Settings -> Build, Execution, Deployment -> Toolset and Build) and specify there MSBuild global properties:

enter image description here

In your case this should be name - RuntimeIdentifier and value osx-x64

See also:

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
  • This worked, I had tried it before using "runtime" as a variable name as in the command line argument, but that didn't work. Using RuntimeIdentifier worked, I didn't see either of them in the list of MsBuild properties in: https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022 – user19721505 Jul 13 '23 at 20:24
  • @user19721505 was glad to help! If answer works for you - fell free to mark it as accepted one (the checkmark to the left). Also check out the update - added link to .NET related MSBuild props. – Guru Stron Jul 14 '23 at 06:35