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

NuGet Package - Config File is not Copied to Project

$
0
0

I am trying to create a standard logging tool library for multiple projects. I have created a NuGet package which uses the NLog library. However, when I install this NuGet package onto a project, it does not copy the NLog.config file.

I opened the NuGet package and the NLog.config file is in a contentFiles folder. The project that consumes the NuGet package also uses the PackagePreferences style. In Visual Studio IDE, the NLog.config file has Build Action set to None and Copy to Output Directory set to Copy Always.

What is causing it to not copy over to the project?

NLog.config File Properties:

enter image description here

NLog.config is in contentFiles folder (flat file view):enter image description here

.nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <license type="expression">MIT</license>
    <description>Standardized logger to be used in all applications.</description>
    <releaseNotes>Initial release of BESI Logger</releaseNotes>
    <copyright>Copyright 2019</copyright>
    <tags>BESI Logger</tags>
    <dependencies>
      <group targetFramework="netstandard2.0">
        <dependency id="NLog" version="4.6.8" />
      </group>
    </dependencies>

    <contentFiles>
      <files include="NLog.config" buildAction="None" copyToOutput="true" />
    </contentFiles>
  </metadata>
  <files>
    <file src="NLog.config" target="contentFiles" />
  </files>
</package>

Consuming Project's .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BESILogger" Version="1.0.26" />
    <PackageReference Include="CsvHelper" Version="12.2.2" />
    <PackageReference Include="morelinq" Version="3.3.2" />
    <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\BESIData\BESIData.csproj" />
    <ProjectReference Include="..\CSVClient\CSVClient.csproj" />
    <ProjectReference Include="..\EmailClient\EmailClient.csproj" />
  </ItemGroup>

</Project>

Viewing all articles
Browse latest Browse all 3067

Trending Articles



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