简体   繁体   English

NLog.config文件未复制Nuget包

[英]NLog.config file does not get copied Nuget package

I have been working on creating a Nuget package to include my Logger project and NLog into the package. 我一直在努力创建一个Nuget软件包,以将我的Logger项目和NLog包括到该软件包中。 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. dll和依赖项已正确安装,并且可以在我的计算机上正常安装,但NLog.config文件未复制到lib文件夹中。 I have the nuspec file below. 我在下面有nuspec文件。 If I manually move the NLog.config file to the \\bin\\Debug folder it works fine then. 如果我手动将NLog.config文件移动到\\ bin \\ Debug文件夹,则工作正常。

How can i get it to be copied over to that location with the nuspec file. 我如何才能将其与nuspec文件一起复制到该位置。 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>

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. 它将完成工作。

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". 好的,我想这一定是昨晚很晚,为了将其保存到bin \\ debug文件夹,我要做的就是将目标更改为“ content \\ bin \\ debug”。 Once I changed that the Nuget package installed it into that location. 一旦我更改了Nuget软件包,便将其安装到该位置。 Hope that helps someone else too. 希望对别人也有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM