从 dll 创建 nuget 包 [英] Create nuget package from dlls
问题描述
我想创建一个 NuGet 包,它添加多个 .dll 文件作为对我的项目的引用.
我有一个文件夹,里面有 10 个 .dlls 文件.
当我通过 nuget 安装它时,我希望将这些文件添加到项目的引用中.
我想创建一个 nuget 包,它添加多个 .dll 作为对我的项目的引用.
我想给你两个解决方案来实现这一点:
首先,使用NuGet Package Explorer:
- 下载
第二,正如 Lex Li 提到的,我们可以使用 .nuspec 来打包程序集:
下载 nuget.exe.
创建一个新项目.
打开一个cmd并切换到nuget.exe的路径
使用命令行:
nuget spec "PathOfProjectTestDemo.csproj"
打开
TestDemo.csproj.nuspec
文件并修改它并将程序集添加为文件;下面是我的 .nuspec 文件:<?xml 版本=1.0"?><包装><元数据><id>TestDemo</id><版本>1.0.0</版本><作者>测试者</authors><owners>测试人员</owners><requireLicenseAcceptance>false</requireLicenseAcceptance><description>TestDemo</description><releaseNotes>在此版本的软件包中所做的更改摘要.</releaseNotes><版权>版权 2017</版权><标签>标签1标签2</标签></元数据><文件><file src="MultipleDll*.*"目标=lib et461";/></文件></包>
使用打包命令:
nuget pack TestDemo.csproj.nuspec
通过 NuGet 包资源管理器打开 TestDemo 包.
I want to create a NuGet package which adds multiple .dll files as references to my project.
I have a folder with 10 .dlls files in it.
When I install this via nuget, I want these files to be added to the project's references.
解决方案I want to create a nuget package which adds multiple .dll as references to my project.
I would like give you two solutions to achieve this:
First, Use NuGet Package Explorer:
- Download the NuGet Package Explorer.
- Open the NuGet Package Explorer, select the create a new package.
- Add a lib folder on the content tab, and add your dlls file
- Save the package and install it to the project, check if it add references.
Second, Just as Lex Li mention, We could use .nuspec to pack up the assemblies:
Download the nuget.exe.
Create a new project.
Open a cmd and switch path to nuget.exe
Use command line:
nuget spec "PathOfProjectTestDemo.csproj"
Open the
TestDemo.csproj.nuspec
file and modify it and add the assemblies as file; below is my .nuspec file:<?xml version="1.0"?> <package> <metadata> <id>TestDemo</id> <version>1.0.0</version> <authors>Tester</authors> <owners>Tester</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>TestDemo</description> <releaseNotes>Summary of changes made in this release of the package.</releaseNotes> <copyright>Copyright 2017</copyright> <tags>Tag1 Tag2</tags> </metadata> <files> <file src="MultipleDll*.*" target="lib et461" /> </files> </package>
Use pack command:
nuget pack TestDemo.csproj.nuspec
Open the TestDemo package by NuGet Package Explorer.
这篇关于从 dll 创建 nuget 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!