I'm a beginner to C#, working on macOS at the CLI. (I do not have access to IDEs for everyday development; I can use one occasionally for a one-off command, but that's it.)
I'm attempting to add the Krafs.Rimworld.Ref
package from NuGet to my project; this provides, amongst other things, a namespace Verse
.
This project has to be a .NET Framework 4.7.2 project (this, too, I have no control over); thus, I've installed Mono, since I develop on macOS.
My .csproj
(complete) has the following in it:
<PackageReference Include="Krafs.Rimworld.Ref"><Version>1.3.3087</Version></PackageReference>
When I navigated to the folder of the solution containing that .csproj
and run dotnet restore
, it didn't print any useful information; only the following:
❯ HelloCSharp main* dotnet restore Determining projects to restore... All projects are up-to-date for restore.
The instructions for compiling that I'm following offer the following advice on how to build:
FrameworkPathOverride="$(dirname $(which mono))/../lib/mono/4.7.2-api/" \ dotnet build Source/HelloCSharpLibrary/HelloCSharpLibrary.csproj /property:Configuration=Release
Unfortunately, it's still complaining about the Verse
namespace from that ref-only NuGet package missing:
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NETCopyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... All projects are up-to-date for restore./Users/ec/Sync/Code/HelloCSharp/Source/HelloCSharpLibrary/Helloicate.cs(2,7): error CS0246: The type or namespace name 'Verse' could not be found (are you missing a using directive or an assembly reference?) [/Users/ec/Sync/Code/HelloCSharp/Source/HelloCSharpLibrary/HelloCSharpLibrary.csproj]/Users/ec/Sync/Code/HelloCSharp/Source/HelloCSharpLibrary/Helloicate.cs(7,6): error CS0246: The type or namespace name 'StaticConstructorOnStartupAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/ec/Sync/Code/HelloCSharp/Source/HelloCSharpLibrary/HelloCSharpLibrary.csproj]/Users/ec/Sync/Code/HelloCSharp/Source/HelloCSharpLibrary/Helloicate.cs(7,6): error CS0246: The type or namespace name 'StaticConstructorOnStartup' could not be found (are you missing a using directive or an assembly reference?) [/Users/ec/Sync/Code/HelloCSharp/Source/HelloCSharpLibrary/HelloCSharpLibrary.csproj]Build FAILED.
Checking ~/.nuget/packages
, there is indeed a krafs.rimworld.ref/1.3.3087/ref/net472/Assembly-CSharp.dll
downloaded. ILSpy shows it contains the required Verse
namespace and refs. I just can't figure out why the above dotnet build
command can't find those refs, despite the PackageReference
in the .csproj
.
(All of this works fine when done through the GUI on Windows, because of course it does. The issues I'm having are only on macOS / Mono / at the CLI.)