question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime native dll not copied beetween local projects

See original GitHub issue

Steps to reproduce

On the SharpScss repo, I have a SharpScss assembly project that is shipping runtime native libraries and this project is referenced from a SharpScss.Tests xunit tests.

(related issue in SharpScss#6)

When running dotnet test from the src folder, I’m getting DllNotFoundException as It seems not able to resolve the libsass native dlls/so.

When consuming the NuGet package SharpScss, the runtime/native dlls are properly resolved.

In the generated SharpScss.Tests.deps.json, we can see that the runtime native dlls are not listed:

      "SharpScss/1.3.8": {
        "runtime": {
          "SharpScss.dll": {}
        }

while using the NuGet package, they are correctly setup:

      "SharpScss/1.3.8": {
        "runtime": {
          "lib/netstandard1.3/SharpScss.dll": {}
        },
        "runtimeTargets": {
          "runtimes/linux-x64/native/libsass.so": {
            "rid": "linux-x64",
            "assetType": "native"
          },
          "runtimes/osx-x64/native/libsass.dylib": {
            "rid": "osx-x64",
            "assetType": "native"
          },
          "runtimes/win-x64/native/libsass.dll": {
            "rid": "win-x64",
            "assetType": "native"
          },
          "runtimes/win-x86/native/libsass.dll": {
            "rid": "win-x86",
            "assetType": "native"
          }
        }
      },

Expected behavior

When referencing a local project that has runtime native dlls, they should be part of the dependencies when trying to use them from another project.

Actual behavior

Native dlls are not referenced as described above.

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

I’m not sure if this issue belongs to here or to the dotnet/project-system (cc @davkean)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
dasMullicommented, Aug 24, 2017

It would be great to have sth like a @(RuntimeAsset) item that is copied to the right path in outputs and packed correctly… (and e.g. respects the inferred RID for netfx projects etc)

<ItemGroup>
  <RuntimeAsset Include="cool.dylib" RuntimeIdentifier="osx-x64" />
  <RuntimeAsset Include="libcool.so" RuntimeIdentifier="linux-x64" />
  …
</ItemGroup>
7reactions
xoofxcommented, Aug 24, 2017

It gives quite an unbalanced experience. Importing a project should provide what would be imported by the nuget package itself. We should not have to deal with these differences.

Solving this in the tests project is cumbersome, as you basically need to detect which platform you are running, add an explicit references to the native dlls (while the test project should not be aware of it). You can create a shared .targets file, that’s what we had to do in the past on Windows… but that’s really super annoying to have do this, specially in the new .NET Core xplat story which complicates a lot the build.

We should have a parity experience here. Otherwise, it means that whenever you have native dlls, you can’t easily develop cross platform tests and we are forced do develop special build steps to overcome this.

So @wli3, you suggest that this issue could be moved the project-system then? (if yes, @karelz or @davkean could you move the issue?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependent DLL is not getting copied to the build output ...
You can get to the Copy Local property by clicking on the assembly under References and pressing F4. Ran into this same issue....
Read more >
How to package a managed dll with its native dependencies?
Recognize non-dll files in the runtimes/ folder structure. Copy all recognized files to he shadow folder (manged dlls, native dlls, non-dlls), ...
Read more >
Determine which DLLs to redistribute
To determine which DLLs you have to redistribute with your application, collect a list of the DLLs that your application depends on. These...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >
Java Native Interface (JNI) - Java Programming Tutorial
The program will throw a UnsatisfiedLinkError if the library cannot be found in runtime. Next, we declare the method sayHello() as a native...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found