The reference assemblies for .NETFramework,Version=v5.0 were not found (Mac)
Hi,
I'm seeing the following on Rider Mac (2020.3.4 Build RD-203.7717.10) on an ASP.Net Core project targeting SDK 5.
"The reference assemblies for .NETFramework,Version=v5.0 were not found"
The SDK is installed fine and the project compiles and runs on Visual Studio Mac.
Anyone have any ideas?
[EDIT]
So I've found that if I add the .Net Core 5 Project to the Solution using a Rider Windows machine then it shows up under Dependencies as .NETCoreApp 5.0 and this then opens/builds fine on both Rider Windows and Rider Mac. However if I add the Project on a Mac machine it shows up under dependencies as .NETFramework 5.0 and then it won't build on Rider Mac, but it does still build on Visual Studio Mac.
Please sign in to leave a comment.
Hi Leon,
That is very interesting! Could you please explain how exactly you add such project on a Mac machine? A screenshot would be appreciated. I'll try to reproduce the issue on my machine. Also, please tell which MSBuild Rider is using when it cannot build your project (Preferences | Build, Execution, Deployment | Toolset and Build -> Use MSBuild version).
Hi Julia,
On the Mac I am doing right clicking on the Solution -> Add, New Project and then I get the dialog as per the image I have uploaded.
I can't change the framework. As mentioned if I do the same thing on Rider Windows it works perfectly and I end up with a NetCoreApp project (which then builds fine on the Mac)... but when I add the project on Rider Mac then I have the issue. All relevant SDK's are installed.
With respect to which MS Build is being used... it is set to "Auto Detected (15.0)"
Any assistance would really be appreciated.
Thx, Leon
Hi Leon,
I guess that your Rider on Mac machine has problems detecting either the SDKs or the MSBuilds. Could you please post here the output of `dotnet --list-sdks` on your Mac, and a screenshot of Rider's Preferences | Build, Execution, Deployment | Toolset and Build with expanded Use MSBuild version dropdown.
Thank you!
Hi Julia,
Ok, here is the information requested. Thx for the assistance.
leon@Leons-MBP:~$ dotnet --list-sdks
2.1.505 [/usr/local/share/dotnet/sdk]
2.2.203 [/usr/local/share/dotnet/sdk]
2.2.207 [/usr/local/share/dotnet/sdk]
3.0.100-preview9-014004 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.100-preview3-014645 [/usr/local/share/dotnet/sdk]
3.1.100 [/usr/local/share/dotnet/sdk]
3.1.101 [/usr/local/share/dotnet/sdk]
3.1.102 [/usr/local/share/dotnet/sdk]
3.1.200 [/usr/local/share/dotnet/sdk]
3.1.201 [/usr/local/share/dotnet/sdk]
3.1.202 [/usr/local/share/dotnet/sdk]
3.1.300 [/usr/local/share/dotnet/sdk]
3.1.301 [/usr/local/share/dotnet/sdk]
3.1.302 [/usr/local/share/dotnet/sdk]
3.1.401 [/usr/local/share/dotnet/sdk]
3.1.402 [/usr/local/share/dotnet/sdk]
3.1.403 [/usr/local/share/dotnet/sdk]
3.1.404 [/usr/local/share/dotnet/sdk]
3.1.405 [/usr/local/share/dotnet/sdk]
3.1.406 [/usr/local/share/dotnet/sdk]
3.1.407 [/usr/local/share/dotnet/sdk]
5.0.100 [/usr/local/share/dotnet/sdk]
5.0.101 [/usr/local/share/dotnet/sdk]
5.0.102 [/usr/local/share/dotnet/sdk]
5.0.103 [/usr/local/share/dotnet/sdk]
5.0.200 [/usr/local/share/dotnet/sdk]
5.0.201 [/usr/local/share/dotnet/sdk]
Leon,
Thanks for the information! What if you try to choose 16.0 MSBuild version in settings manually (Preferences | Build, Execution, Deployment | Toolset and Build)? Does Rider succeed to build your solution? If not, please reproduce the problem with 16.0 MSBuild selected and collect Rider logs via Help -> Collect Logs. You can upload the archive to https://uploads.jetbrains.com/
Hi Julia,
If I choose MS Build 16 then the solution doesn't build at all. I have however just discovered something which I think may assist you in tracking down the problem.
On the Mac, if I create a new solution using the ASP.Net Core Web Application Template, set the Type to Web API and Framework to net5.0 then it all works fine, Dependency is .NetCoreApp 5.0 and the solution builds no problem. And btw MSBuild16 is auto-detected.
The issue occurs when I create a new solution using the Xamarin Application template and then attempt to add an ASP.Net Core Web Application template to it. This is when MSBuild15 is auto-detected and it inits as a .NetFramework5 project (but only on Mac) and then doesn't build.
So if I keep my Xamarin project and API project in separate solutions then it works fine... but when I attempt to add the API (NetCore5) project to the Xamarin solution then I have the issue. A NetCore3.1 API project however works fine in the same solution.
All works fine in Visual Studio Mac... create xamarin solution, add .NetCore 5 Api project... and it builds. Rider doesn't build this. If I downgrade the API project to 3.1 then Rider builds that.
Hope this helps.
Thank you, it helps! I can confirm that you've run into a known problem in Rider. The workaround for now is to manually choose an MSBuild from VS for Mac in Rider settings. Go to
Preferences | Build, Execution, Deployment | Toolset and Build
and set custom msbuild path to the next one:(Numbers in the actual path can be different on your machine).
Rider 2021.1 will be able to autodetect that MSBuild from VS for Mac in cases like yours (RIDER-55608). Here is the issue to make Rider handle such solutions without Visual Studio for Mac: RIDER-58915
JetBrains Rider 2019.3.4
(I cannot upgrade unless our company's I.T. department verifies a product) (Above is my current version).
As stated above, I went to:
Preferences | Build, Execution, Deployment | Toolset and Build
I changed the value of "Use MSBuild Version:" .. to the drop down list item of "Latest installed (16.0) - /usr/local/share/dotnet/sdk/5.0.203/MSBuild.dll"
That worked for me.
FYI:
My target frameworks were
Computer is Mac.
Granadacoder,
Great to hear that everything works fine for you. Let me know if you have any questions about Rider.
I hit the same problem; I upgraded to 2024.1.2 and that didn't solve it. But the solution given here appears to have fixed it.
In the relevant section of Settings / Build,Execution,Deployment / Toolset and Build, The field “MSBuild version” was set to 15.0 with a path in /Library/Frameworks/Mono.framework. One of the options in the dropdown was “Auto detected (17.0)” with a path in /usr/local/share/dotnet. Although this was marked “auto detected”, it wasn't the selected option.
This is on a new Solution using the .NET Console app template. The problem shows up immediately in that the starter program `Program.cs` invokes `Console.WriteLine`, and `Console` is shown in red. I have other existing Rider projects/solutions that don't show the problem.
I'm on an Apple M1 Pro running Sonoma 14.3.1.I suspect the problem may be that I have bits of .NET software lying around from an automatic restore of a previous Intel Mac, making any attempt to find software by auto-detection hazardous. I attempted to tidy up my .NET installation, but to no avail.
I am happy to hear that the solution was found. Such an error is expected to appear when a project that targets .NET 5 or higher is being built with MSBuild from Mono. Mono is not supposed to be used with .Net 5+ projects, as it is intended to build .Net Framework projects.
If you have any other questions or difficulties in the future, do not hesitate to contact support.
Have a great day!
Thanks, yes. I was quite unaware that Mono was installed on the machine or that Rider would go looking for it. A typical example of what happens when software tries to be smart but isn't quite smart enough.
Might it be you were developing .Net Framework project before created a .NET 5+ project?
When MSBuild version is set to Autodetected, Rider switches the MSBuild based on the solution user opens. So Rider can switch between Mono and .Net by itself. However, if MSBuild version is set manually to non Auto-Detected, it could happen that the selected MSBuild is saved per machine, so that, after openning another project, a wrong MSBuild can be set.
Also, a similar error might be encountered if you open a solution that contains .Net Framework projects together with .Net 5+.
I'm afraid that creating new projects is something I do rather rarely, so there's (a) a good chance I will do something stupid while doing it, and (b) a rather slim chance that I will be able to repeat it a couple of weeks later.
Have a nice day!