1
votes

I have been working on creating a Nuget package to include my Logger project and NLog into the package. The dll's and dependencies are correctly setup and it installs fine on my machine but the NLog.config file does not get copied over to the lib folder. I have the nuspec file below. If I manually move the NLog.config file to the \bin\Debug folder it works fine then.

How can i get it to be copied over to that location with the nuspec file. I have also tried to set the target to the "content" folder which copies it to the root folder but that doesnt work either. Please let me know as i have been trying for hours to get this right. I appreciate the help, thanks

<?xml version="1.0"?>
<package >
 <metadata>
   <id>Packager</id>
    <version>1.0.0</version>
    <title>EYPackager</title>
    <authors>rmifss</authors>
    <owners></owners>
    <description>
    </description>
    <releaseNotes>
    </releaseNotes>
    <summary>
    </summary>
   <language>en-US</language>
   <projectUrl>https://nuget.org/packages/Packager</projectUrl>
   <iconUrl>https://nuget.org/Content/Images/packageDefaultIcon-   
   50x50.png</iconUrl>
   <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
    <copyright>Copyright  2014</copyright>
   <dependencies>
     <dependency id="NLog" version="2.1.0" />
   </dependencies>
   <references></references>
   <tags></tags>
  </metadata>
  <files>
    <file src="..\PanaceaLogging\bin\Debug\Panacea.dll" target="lib" />
    <file src="..\PanaceaLogging\bin\Debug\NLog.config" target="lib" />
    <file src="lib\" target="lib" />
    <file src="tools\" target="tools" />
    <file src="content\" target="content" />
  </files>
 </package>
2
If you want to create a package for redistributing an application, the use Chocolatey, not NuGet. NuGet is for build-time dependencies, Chocolately for run-time dependencies.Matthew Skelton

2 Answers

0
votes

In the solution explorer, find your config file. then right click->properties In the property explorer find the "copy in output directory" cell and then select "Always copy". It will do the job.

0
votes

Ok I think it must have been a late night last night, in order to get it to the bin\debug folder, all i had to do was change the target to "content\bin\debug". Once I changed that the Nuget package installed it into that location. Hope that helps someone else too.