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

Creating a NuGet package with .exe file as content file

$
0
0

I have been trying to include the 7za.exe file from the installed 7ZipCLI NuGet package into a project, of which I want a NuGet package to be created. The NuGet package targets both.NET Standard2.0 and .NET Framework v4.6.1+. I am using the Net Standard capability of creating NuGet packages on Build.

The Fonts copy perfectly to the NuGet package, but the .exe does not want to copy.

Can someone please help me get the 7za.exe to be placed in the package's content folder? It does not need to be the content folder, I just want it copied to the consuming project's output directory on Installing of the NuGet package.

Here is the .csproj file:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFrameworks>netstandard2.0;net461</TargetFrameworks><GeneratePackageOnBuild>true</GeneratePackageOnBuild><Version>1.1.13</Version><TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeAssemblyReferences</TargetsForTfmSpecificBuildOutput><Platforms>x86</Platforms><PackageId>DocumentGeneration</PackageId><Authors>Me</Authors><Company>Me</Company><Product>DocumentGeneration</Product><Description>A library for creating PDF documents.</Description><PackageTags>Report Certificate Generator iText PDF</PackageTags><AssemblyVersion>1.0.0</AssemblyVersion><FileVersion>1.0.0.0</FileVersion><CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies></PropertyGroup><PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'"><OutputPath>$(SolutionDir)Output\</OutputPath><DocumentationFile>$(SolutionDir)Output\DocumentGeneration.xml</DocumentationFile><GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources><DebugType>full</DebugType><DebugSymbols>true</DebugSymbols></PropertyGroup><PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'"><OutputPath>$(SolutionDir)Output\</OutputPath><DocumentationFile>$(SolutionDir)Output\DocumentGeneration.xml</DocumentationFile><GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources><DebugType>embedded</DebugType><DebugSymbols>true</DebugSymbols></PropertyGroup><ItemGroup><Content Include="Resources\Arial.ttf"><CopyToOutputDirectory>Always</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput><CopyToPublishDirectory>true</CopyToPublishDirectory></Content><Content Include="Resources\HelveticaNarrow.otf"><CopyToOutputDirectory>Always</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput><CopyToPublishDirectory>true</CopyToPublishDirectory></Content></ItemGroup><ItemGroup Condition="'$(TargetFramework)' == 'net461'"><PackageReference Include="iTextSharp" Version="5.5.13.2" /></ItemGroup><ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'"><PackageReference Include="itextsharp.netstandard" Version="5.5.13.2" GeneratePathProperty="true" /><PackageReference Include="System.Drawing.Common" Version="5.0.0" GeneratePathProperty="true" /><PackageReference Include="System.Resources.Extensions" Version="5.0.0" /><PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" /></ItemGroup><ItemGroup><PackageReference Include="7ZipCLI" Version="9.20.0" GeneratePathProperty="true" IncludeAssets="all" /><PackageReference Include="System.Text.Encoding" Version="4.3.0" /><PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" /></ItemGroup><ItemGroup><None Include="readme.txt" pack="true" PackagePath="." /></ItemGroup><ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"><None Include="$(Pkgitextsharp_netstandard)\lib\netstandard2.0\itextsharp.netstandard.dll"><CopyToOutputDirectory>Always</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput><Visible>false</Visible></None><Content Include="$(Pkg7ZipCLI)\tools\7za.exe"><CopyToOutputDirectory>Always</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput><PackagePath>content\Resources;contentFiles\any\any\Resources</PackagePath><Visible>false</Visible></Content></ItemGroup><ItemGroup Condition="'$(TargetFramework)' == 'net461'"><Content Include="$(Pkg7ZipCLI)\tools\7za.exe"><CopyToOutputDirectory>Always</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput><PackagePath>content\Resources;contentFiles\any\any\Resources</PackagePath><Visible>false</Visible></Content></ItemGroup><ItemGroup><Compile Update="Properties\Resources.Designer.cs"><DesignTime>True</DesignTime><AutoGen>True</AutoGen><DependentUpon>Resources.resx</DependentUpon></Compile></ItemGroup><ItemGroup><EmbeddedResource Update="Properties\Resources.resx"><Generator>PublicResXFileCodeGenerator</Generator><LastGenOutput>Resources.Designer.cs</LastGenOutput></EmbeddedResource></ItemGroup><Target Name="IncludeAssemblyReferences"><ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"><BuildOutputInPackage Include="$(Pkgitextsharp_netstandard)\lib\netstandard2.0\itextsharp.netstandard.dll"><Visible>false</Visible></BuildOutputInPackage></ItemGroup></Target></Project>

Also here is what the NuGet package looks like currently:

Current NuGet Package


Viewing all articles
Browse latest Browse all 3067

Trending Articles



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