Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse the nuget nuspec list

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to parse the nuget nuspec list, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Create a NuGet package

Before creating a NuGet package, we should create a xml manifest file with the suffix .nuspec, which describes the contents of the package and plays an important role in installing the NuGet package. In fact, it works just like app.config and is an integral part of it, so it's important to know what an nuspec manifest file is before you know how to create a NuGet package.

What is a .nuspec manifest file

The nuspec file is a manifest file in xml format that describes the contents of the package and the generation process of the driver package. Here is a typical nuspec file definition:

Xxx.xxx.xxx 1.0.0.1 nizhenghua nizhenghua http://opensource.org/licenses/MS-PL http://github.com/nizhenghua https://cache.yisu.com/upload/information/20210524/347/782120.png false Bug fixes and performance improvements xxxxxxxxxxxxxxxxx Copyright ©2016 xxxxx

The nuspec must contain the following information:

Id: identifier, which must be unique within the managed library

Version

Title: for display in NuGet libraries

Authors

Owners

Description

In addition, it can also contain releaseNotes, coptright, tags and other information.

Create a nuspec manifest file using the nuget command line tool

Create from a project

Navigate to the directory that contains the csproj project file, and execute nuget spec

Created from an existing dll

Nuget spec dll path

Created by a convention-based directory

Folder description toolspowershell script and command line program contents are copied to the project, tools folders are added to the environment variables libdll, xml, pdb, etc. Dll is added to the reference, xml and pdb are copied to the project content any file contents are copied to the project root directory buildMSBuild target and props files are automatically inserted into the project file (NuGet2.x) or project.json.lock (NuGet3.x) set package type

Dependency: can be installed in any project with compatibility

DotnetCliTool: as an extension of .NET CLI, it must be called on the command line and can only be used in .NET Core projects

Custome

Create a NuGet package

Nuget pack xxx.nuspec

Nuget pack xxx.csproj

If you use the command under the current nuspec manifest folder, you can abbreviate: nuget pack

Compilation Settin

Nuget pack xxx.csproj-properties Configuration = Release

Include symbol file

Use nuget pack xxx.csproj-symbols to type symbol information into the package together.

The version number setting of the dependency

You can set your own dependency information on other packages in the nuspec manifest. For example:

The set dependencies will install themselves after the package installation is complete. The most important attribute is Version. There may be multiple versions of a package through constant update iterations, and you can use Version to specify which version of the package to rely on. NuGet also provides a set of symbols with a specified version range so that we can set the version number of dependencies more flexibly.

Symbol application rule description 1.0x > = 1.0 greater than or equal to 1.0 version (, 1.0) x

< 1.0小于1.0版本(1.0,)x >

1.0 greater than 1.0 version [, 1.0] x = 1.0 greater than or equal to 1.0 version (1.0meme 2.0] 1.0 < x

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report