dotnet build not including .dep files in build output
We are using a nuget package which has it dependencies bundled up as a .dep file, when we run dotnet build, the .dep file is not included in out outputted bin file. (This used to work with dnx)
Steps to reproduce
Create a new netcore project (class library will be fine) set framework to net4xx as this library doesn't have an option for core yet
SAMPLE Project.json
{ "version": "1.0.0-*", "dependencies": { "hiqpdf.free": "9.21.0" }, "frameworks": { "net461":{} } }
once package restore has completed, run dotnet build
Expected behavior
Expected the packages .dep file to be in the bin
Actual behavior
.dep file is not included in bin
I have also tried to force it using:
"buildOptions": { "embed": "**/*.dep" }
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information: Version: 1.0.0-preview2-003121 Commit SHA-1 hash: 1e9d529bc5
Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64
I have come up with an ugly work around for now.
- Copy .dep file from package into your project. (add to source control so that your build server has access to it)
- Add the following to your build options:
"copyToOutput": [ "*.dep" ]
Glad you found a workaround. I'm curious about the structure of the NuGet package. Is the *.dep file included as content?
Here is an example of a package which contains a .dep file https://www.nuget.org/packages/hiqpdf.free/
when i open the package in Nuget Package Explorer: .dep file is in a lib/net40 folder, and not included as content please see screenshot: https://snag.gy/qBDOng.jpg
directory structure of package: Directory: C:\Users********.nuget\packages\hiqpdf\8.10.0\lib\net40 Mode LastWriteTime Length Name
-a---- 2016/02/12 10:58 AM 16770048 HiQPdf.dep -a---- 2016/02/12 10:58 AM 2176512 HiQPdf.dll -a---- 2016/02/12 10:58 AM 331502 HiQPdf.xml
I examined the referenced nupkg for hiqpdf and saw that the nuspec did not list any contentfiles. This resulted in the restore operation generating a project.lock.json which only referenced the dll runtime assembly as a consumable from this package. In order to get the .dep file into the output project the package authoring will need to be updated to specify this file as content.
Thanks, i will contact the package vendor
I know this topic is outdated but I would like to share my solution in order to help someone that was struggling with it.
The project that uses SDK-style need to declare the files to be copied to output folder (bin as default). So, here is the snippet. I set the boolean property GeneratePathProperty to true and I made use of the variable $(Pkghiqpdf) for finding the path baseline. This is composed by the prefix Pkg + package name as it is in Include attribute (replace periods by underscores).
<ItemGroup>
<PackageReference Include="hiqpdf" Version="10.15.0" GeneratePathProperty="true" />
</ItemGroup>
<Target Name="CopyHiqpdfFiles" AfterTargets="Build">
<Copy SourceFiles="$(Pkghiqpdf)\lib\net40\HiQPdf.dep" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="$(Pkghiqpdf)\lib\net40\HiQPdf.rda" DestinationFolder="$(OutDir)" />
</Target>