Nuget post build event - adding files to path inside .nupkg

时间:2016-10-20 19:44:05

标签: c# dll visual-studio-2015 nuget nuget-package

I'm posting this here since I haven't been able to get any help from nuproj's github page.

I have some files I need to write to a specific path in my .nupkg file. After a successful build, I would like to place several files into a specific path (runtimes/win7-x64/native) instead of the default 'lib/net45' folder.

Right now, I have to open the .nupkg file (I use Nuget Package Explorer) and manually create the (runtimes/win7-x64/native) folder structure then add the appropriate files. Note - these files have to be in this specific path in order for them to work in my project.

Basically, how do I go about using nuproj to handle this for me and eliminate the need for me to do it manually? I've attached an image to better illustrate my question (the part in red is what I'm trying to automate).

enter image description here

1 个答案:

答案 0 :(得分:1)

您可以编辑nuspec文件并设置目标的文件夹路径。

How to add a folder to a nuspec file

然后在命令行中使用已编辑的nuspec文件创建.nupkg文件。

http://www.hanselman.com/blog/CreatingANuGetPackageIn7EasyStepsPlusUsingNuGetToIntegrateASPNETMVC3IntoExistingWebFormsApplications.aspx

然后您可以将命令行添加到构建后事件。