You'll need to point the runtime to the location of the OpenSSL binaries using environment variables.
To get things working from your IDE, try adding something like the following to your launchSettings.json
file:
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"MyProjectName": {
"commandName": "Project",
"applicationUrl": "https://localhost:7069;http://localhost:5042",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DYLD_LIBRARY_PATH": "/opt/homebrew/opt/openssl@3/lib"
}
}
}
}
The important part here is the line that sets the DYLD_LIBRARY_PATH
variable. You'll need to do something similar in your deployment environment too.
To get things working in the Rider test runner you'll probably have to change your .sln.DotSettings
file. The easiest way to do this is to using the Rider UI. Go to Preferences > Build, Execution, Deployment > Unit Testing > Runner and add the environment variable using the controls at the bottom of the dialog.
My .sln.DotSettings
file ended up looking like this (but with horrible formatting):
<wpf:ResourceDictionary
xml:space="preserve"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String
x:Key="/Default/Housekeeping/UnitTestingMru/UnitTestRunner/EnvironmentVariablesIndexed/=DYLD_005FLIBRARY_005FPATH/@EntryIndexedValue">/opt/homebrew/opt/openssl@3/lib
/s:String>
</wpf:ResourceDictionary>
To get tests working from the command line, I'd recommend adding a .runsettings
file and referencing it from your .csproj
file.
My .runsettings
file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<DYLD_LIBRARY_PATH>/opt/homebrew/opt/openssl@3/lib</DYLD_LIBRARY_PATH>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings>
and my project file looks something like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Dave Watts</Authors>
....
<RunSettingsFilePath>$(ProjectDir).runsettings</RunSettingsFilePath>
</PropertyGroup>