© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•10mo ago•
13 replies
orlando pedro

Go To Declaration doesn't consider RID for a Nuget package

I'm developing a OS-specific library with bunch of #if directives. As an example, consider the following method:
public static void Method1()
{
#if WIN_X64
  Console.WriteLine("Win");
#elif LINUX_X64
  Console.WriteLine("Linux");
#else
  throw new PlatformNotSupportedException();
#endif
}
public static void Method1()
{
#if WIN_X64
  Console.WriteLine("Win");
#elif LINUX_X64
  Console.WriteLine("Linux");
#else
  throw new PlatformNotSupportedException();
#endif
}

and for that library, my
.nupkg
.nupkg
consists of the following files/folders:
- lib\net9.0\MyLib.dll -> fallback binary if no suitable runtime is found. Call to
Method1()
Method1()
throws
PlatformNotSupportedException
PlatformNotSupportedException

- ref\net9.0\MyLib.dll -> reference-assembly for API surface
- runtimes\win-x64\lib\net9.0\MyLib.dll -> binary for Windows. Call to
Method1()
Method1()
outputs
Win
Win

- runtimes\linux-x64\lib\net9.0\MyLib.dll -> binary for Linux. Call to
Method1()
Method1()
outputs
Linux
Linux


When the library is imported and the method
Method1()
Method1()
is called — everything works as expected.

Issue:
When I Ctrl+Click (Go To Declaration) on the method to explore its internals, it does not consider
RID
RID
and displays the fallback-binary from
lib\
lib\
folder, where the method just throws, making "Go To Declaration" useless.
Whereas during debugging, stepping into the method DOES work, displaying the correct, decompiled, runtime-specific binary.

Desired behavior:
"Go To Declaration" considers
RID
RID
and decompiles runtime-specific binary from
runtimes\
runtimes\
folder.

Tried:
Specifying
RID
RID
during package restore:
dotnet restore -r win-x64
dotnet restore -r win-x64
, and unfortunately, it didn't do the trick.

Question:
Is that me who packed binaries incorrectly, or I have to dig into Rider's behavior?
rider64_6iETP4jT8Q.gif
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ NuGet Package doesn't get recognized
C#CC# / help
3y ago
✅ NuGet package doesn't exist in current context
C#CC# / help
16mo ago
❔ Create NuGet packages package extensions
C#CC# / help
3y ago
❔ Can't use TorchSharp nuget package
C#CC# / help
4y ago