I have a console app project (.net core 2.1) which is my "custom package". The output of the package is the * .dll file.
I have installed my own package on different projects.
after
dotnet publish
I see that *.dll (from the package) file in the publish folder.
When I am trying to run this dll. I have an error like this:
Cannot use file stream for [D:\Daily\Daily*.deps.json]: No such file or directory A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'D:\Daily\Daily'. Failed to run as a self-contained app. - The application was run as a self-contained app because 'D:\Daily\Daily*.runtimeconfig.json' was not found. - If this should be a framework-dependent app, add the 'D:\Daily\Daily*.runtimeconfig.json' file and specify the appropriate framework.
I spend some time to search a solution for my case but I can not fix it with possible solutions which I found.
When I did
dotnet publish
on the Package Project in outputs I see all what I need.
Problems occurs when package is installed in different project.
I tried to use
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
My nuspec file below:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ProjectName</id>
<version>1.0.0.0</version>
<title>ProjectName</title>
<authors></authors>
<owners></owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description></description>
<copyright>Copyright © 2021</copyright>
<dependencies>
<group targetFramework=".NETCoreApp2.1">
some dependencies
</group>
</dependencies>
<summary>ProjectName package</summary>
<contentFiles>
<files include="**" buildAction="None" copyToOutput="true" flatten="false" />
</contentFiles>
</metadata>
<files>
<file src="..\ProjectName\bin\Release\netcoreapp2.1\ProjectName.dll" target="lib\netcoreapp2.1\" />
<file src="..\ProjectName\bin\Release\netcoreapp2.1\ProjectName.deps.json" target="lib\netcoreapp2.1\" />
<file src="..\ProjectName\bin\Release\netcoreapp2.1\ProjectName.runtimeconfig.json" target="lib\netcoreapp2.1\" />
<file src="..\ProjectName\bin\Release\netcoreapp2.1\ProjectName.runtimeconfig.dev.json" target="lib\netcoreapp2.1\" />
</files>
</package>