Copy runtime libraries from references project
See original GitHub issueI have Library.csproj with following code:
<ItemGroup>
<Content Include="runtimes\win7-x86\native\**\*">
<PackagePath>.</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>
When I run dotnet pack, I can see native dll-s in the generated package. If I reference this NuGet package (using my own feed) in the another project then all libraries are correctly placed into bin folder. But if I reference this project directly then libraries are not copied.
We need to have one uniform way to add native libraries into project and use them in all scenarios:
- Directly in this project
- In other project that references this project
- In the generated NuGet package
Issue Analytics
- State:
- Created 7 years ago
- Reactions:12
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Visual Studio projects copy dependencies from referenced ...
Is it possible to make Visual Studio to copy all dependencies of referenced projects into the output path? Example. In the Solution, Project...
Read more >Manage references in a project - Visual Studio (Windows)
If you see a References node in Solution Explorer, you can use the right-click context menu to choose Add Reference. Or, right-click the...
Read more >How to copy dependent assemblies to the bin folder on build?
How to copy referenced assemblies to the bin folder on build? Open your project file. Simple enough, just select “Edit Project File” by...
Read more >Linked project items do not get copied to the output directory
I just tried this solution with one of my nuget packages. This only copies the dll to the output directory of the project...
Read more >How to stop references being copied to output directory ...
When using dotnet build on the My.Assembly project, the Private assemblies are always copied to the /external/ folder (resulting in multiple ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have made an extreme hack to add runtime libraries into deps.json: https://github.com/asmichi/DotNetInjectNativeFileDepsHack WARNING: This will likely break in a future version of the .NET SDK.
The problem is that runtime libraries from reference projects do not appear in
deps.json
and thus cannot be loaded byDllImport
. Only NuGet libraries can haveruntimeTargets
! Okay, then, trick the build to add runtime libraries into an existing NuGet library.Another thing that doesn’t seem to be possible at the moment is specifying a subdirectory where the native library ends up after publish. Right now they’re all emitted to the root (
/publish/
) directory, regardless if they reside in a subdirectory inside the NuGet package itself (/runtimes/<arch>/native/sub1/sub2/mylib.dll
).