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

How to pack an executable alongside .NET DLL into the NuGet package?

$
0
0

I have a .NET 6.0 library that targets Windows 10. The library is marked with <OutputType>Exe</OutputType> because it has to be callable from command line.

The library is packaged into a NuGet using dotnet pack.

Problem is the .exe file is not getting embedded into the .nuget. The only file that ends up in the .nuget is lib\net6.0-windows10.0.19041\MyLib.dll

My final goal is for MyLib.exe to be copied alongside MyLib.dll when the library is referenced from the NuGet via PackageReference.

E.g.

MyLib.csproj

<Project><PropertyGroup><TargetFramework>net6.0-windows10.0.19041.0</TargetFramework><OutputType>Exe</OutputType></PropertyGroup></Project>

MyApp.csproj

<Project><PropertyGroup><TargetFramework>net6.0-windows10.0.19041.0</TargetFramework><OutputType>Exe</OutputType></PropertyGroup><ItemGroup><PackageReference Include="MyLib" Version="1.0.0" /></ItemGroup></Project>

I want to see both MyLib.dll and MyLib.exe alongside MyApp.exe when MyApp is built and/or published. With the project files like above only MyLib.dll is present in .nuget and gets copied when MyApp is built.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



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