Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Create nuget package that references referenced .dlls without using .nuspec

$
0
0

Problem: Top level project references MyLibrary nuget which references several vendor.dll files. Vendor.dll files should be able to be referenced by top level project when MyLibrary nuget package is added to top level project but they are not.

When I run the top level project I receive this error:

FileNotFoundException: Could not load file or assembly 'Vendor.A, Culture=neutral, PublicKeyToken=b88d1754d700e49a'. The system cannot find the file specified.

Vendor .dll files are not copied to bin folder.

I hope to find a resolution to this problem that does not require me to create a .nuspec file.

Structure of generated MyLibrary nuget package (observed with Nuget package explorer):

lib    net5.0-windows        Vendor.a.dll        Vendor.b.dll    net5.0-windows7.0        MyLibrary.dll

I do not understand where net5.0-windows7.0 comes from. It does not exist in TFM list referenced below. Also, if net5.0-windows7.0 is for some reason necessary, why does MyLibrary.dll exist there but not the .dlls it depends on?

Looking at the package from within Visual Studio 2019 it appears as follows (vendor dlls do not appear):

Packages    MyLibrary        Compile Time Assemblies            MyLibrary.dll

MyLibrary.csproj:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"><PropertyGroup><TargetFramework>net5.0-windows</TargetFramework><UseWPF>true</UseWPF><GeneratePackageOnBuild>true</GeneratePackageOnBuild></PropertyGroup><PropertyGroup><AssemblyVersion>1.0.0.1</AssemblyVersion><FileVersion>1.0.0.1</FileVersion><Version>1.0.0.3</Version></PropertyGroup><ItemGroup><Content Include="$(OutputPath)\Vendor.*.dll"><Pack>true</Pack><PackagePath>lib\$(TargetFramework)</PackagePath></Content></ItemGroup><ItemGroup><Reference Include="Vendor.a"><HintPath>VendorLib\Vendor.a.dll</HintPath></Reference><Reference Include="Vendor.b"><HintPath>VendorLib\Vendor.b.dll</HintPath></Reference></ItemGroup>

TopLevel.csproj

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"><PropertyGroup><OutputType>WinExe</OutputType><TargetFramework>net5.0-windows</TargetFramework><UseWPF>true</UseWPF></PropertyGroup><ItemGroup><PackageReference Include="MyLibrary" Version="1.0.0.3" /></ItemGroup>

Target Framework Monikers

Similar question

Similar question requiring nuspec

Similar question requiring nuspec


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>