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.