Is it posible to use Rider with Mono on Ubuntu?
Hi, I'm developing a project that currently runs under mono on Ubuntu. I've recently upgraded it to use the new csproj format and made it work under both, mono and .NET5.
Using the command line, I'm able to compile the project using either msbuild from mono or dotnet build from dotnet-sdk-5.0. It also works in the latest available MonoDevelop. The latter is no longer well maintained though, so I switched to Rider. Unfortunately, it fails to load the solution on a machine without dotnet installed and only with mono 6.12 installed with the following error:
Project 'MyProject' load failed
[MSB4236] The SDK 'Microsoft.NET.Sdk' specified could not be found.
.NET Core was not found
Rider could not find .NET Core installation on this machine.
Install .NET Core.
If .NET Core is installed in a non-standard location, please specify the custom .NET CLI execution path in settings.
The csproj looks like that:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- ... -->
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
When I remove the `Sdk` attribute, it loads the project but then fails to restore NuGet with a lovely `Object reference not set to an instance of an object` error...
Can't restore NuGet packages in integrated projects
Object reference not set to an instance of an object.
Settings Sources Packages folder
Restore failed
Object reference not set to an instance of an object.
Settings Sources Packages folder
Some more log:
@ Restoring packages in solution MySolution started
@ RestorePackagesConfig: Start
@ There are no packages in solution
@ RestorePackagesConfig: Finish
@ RestorePackageReferences: Start
@ Restoring NuGet packages for integrated projects: start
Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.DependencyGraphRestoreUtility.GetSolutionRestoreSpecAndAdditionalMessages(ISolutionManager solutionManager, DependencyGraphCacheContext context)
at NuGet.PackageManagement.DependencyGraphRestoreUtility.GetSolutionRestoreSpec(ISolutionManager solutionManager, DependencyGraphCacheContext context)
at JetBrains.ProjectModel.NuGet.Operations.NuGetRestoreOperation.RestorePackageReferences(NuGetNotificationMode mode, NuGetRestoreStrategy strategy, NuGetOperationReporter reporter, Messenger messenger, NuGetOperationAggregatedResult result, Nullable`1 specificEngine, IEnumerable`1 projects)
Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.DependencyGraphRestoreUtility.GetSolutionRestoreSpecAndAdditionalMessages(ISolutionManager solutionManager, DependencyGraphCacheContext context)
at NuGet.PackageManagement.DependencyGraphRestoreUtility.GetSolutionRestoreSpec(ISolutionManager solutionManager, DependencyGraphCacheContext context)
at JetBrains.ProjectModel.NuGet.Operations.NuGetRestoreOperation.RestorePackageReferences(NuGetNotificationMode mode, NuGetRestoreStrategy strategy, NuGetOperationReporter reporter, Messenger messenger, NuGetOperationAggregatedResult result, Nullable`1 specificEngine, IEnumerable`1 projects)
at JetBrains.ProjectModel.NuGet.Operations.NuGetRestoreOperation.RestoreSolutionAsync(Int32 nestedLevel, NuGetNotificationMode mode, NuGetRestoreStrategy strategy, String reason, NuGetOperationReporter reporter, Nullable`1 specificEngine)
@ Restoring packages in solution MySolution finished (0.029 sec)
[Notification][Restore] Can't restore NuGet packages in integrated projects
Object reference not set to an instance of an object.
[Notification][Restore] Restore failed
Object reference not set to an instance of an object.
Is it possible to somehow convince Rider to work with Mono?
Please sign in to leave a comment.
Hi,
It seems that the wrong MSBuild was detected in `File | Settings | Build, Execution, Deployment | Toolset and Build`.
Could you check it and set it to MSBuild from dotnet-sdk-5.0? Can it help?
Thank you for response.
As I wrote in the first post, I don't have dotnet-sdk installed.
My project can be built, tested and ran using either mono or dotnet. With dotnet, everything works just fine and I'm happy. However, I'm in a transition period and I would like to make sure that mono version still works (build, test, run).
Under `File | Settings | Build, Execution, Deployment | Toolset and Build` I see "Mono executable path: /usr/bin/mono" and "Use MSBuild version: Auto detected (15.0) - /usr/lib/mono/msbuild/15.0/bin/MSBuild.dll"
Are you able to build your project from command line using "/usr/lib/mono/msbuild/15.0/bin/MSBuild.dll"?
Please share an output of the "dotnet --list-runtimes".