.net stardant 2.0 creation and reference instructions-Nuget package

tags: ASP.NET CORE  .net stardant 2.0  Nuget package

Recently, due to work needs, I verified before researching the xml generation. If there is a vacancy and the field content does not meet the requirements, an error message is displayed instead of producing xml content. After the demo test, I feel that it can be used, so I consider packaging it into a class library for later use. Because after consideration, it will use the core project, so I wanted to create a .net stardant 2.0 class library. In the process of its creation and release, there is this article, which is a summary of this knowledge point, and I want to share it.

 

Create a .net stardant 2.0 class library project-reference another library to create a custom class library. such as:System.ComponentModel.DataAnnotations,Newtonsoft.Json, etc. Because my verification considers usingDefinition features in DataAnnotations.

 

After writing a custom function, right-click on the project = "Properties" and check the "Produce NuGet package (G) during build" check box as shown above. Then compile and generate the project, you can see the NuGet package produced in debug.

 

As shown in the figure below, in the newly created project, open the "NuGet Package Manager" and click the icon in the upper right corner.

 

As shown in the figure below, add the source of the custom package and select the custom NuGet package set in the first image of this article.

 

Then select the source of the added package and add a custom package.

 

The above content is just a way for .net stardant 2.0 to reference, and .net stardant 2.0 only supports .net 4.6 and above versions to add references. So if you are using .net framework 4.6 or above or .net core project, you can consider producing Nuget packages.

The other is the same as the .net framwork reference method, just add the dll file reference directly. But this way is only when other libraries are not referenced in the custom class library, that is, all functions are manually implemented by you. Direct reference to dll, mainly to consider the compatibility of some projects can only use. Net framework 4.6 version below.

Another way is to publish directly. The specified file directory is published. The result of the publication is to generate a Nuget package. Refer to the above description for the reference method. Regarding this point, you can understand it yourself.

Intelligent Recommendation

Release Rafy .NET Standard Nuget package

In the middle of last year, the source code of the Rafy framework already supported the Net Standard 2.0 version. The open source code has also been uploaded to Github: https://github.com/zgynhqf/rafy...

The .net core2 project released the nuget package.

Bale There are many articles about packaging and publishing nuget packages on the Internet. What I recorded here is the special place of the .net core project, which can be packed using the dotnet pac...

.Net package manager under Windows-NuGet

What is it NuGet is a package manager for .NET. The NuGet client tool provides functions for generating and using software packages. NuGet Gallery is a central package repository used by all package a...

Use nuget to package .Net and Native DLL

aims Use Nuget to manage x86/x64 multi-platform, adapt to AnyCPU, x86, x64 compilation options   step 1. Set Package.nuspec 2. SettingsXYZ.props is used to copy Native DLL  ...

Unable to restore nuget package, missing downloadable reference

The NuGet package is missing and the restore failed. The reason is that the NuGet package cannot be found if it is local (generally the display path is C drive). In the tool - NuGet - Manage Solution'...

More Recommendation

Can't find the reference ?! Looking for "NuGet Package Manager"

Foreword    The first B / S project "Sirloin Press Release System" that I have recently contacted, encountered problems in the process of writing the code, and it was not found in ...

NuGet instructions

When you do a project, you often need to add some third-party references. Under the Visual Studio 2019 environment, the most recommended NuGet installation method is to pack all the dependencies packa...

What is Nuget? Why is there NUGET in the .NET project? How to use the Nuget program package?

This article is first published inCode -friendly network – "What is Nuget? Why is there NUGET in the .NET project? How to use the Nuget program package? " Overview Hello everyone, I am...

NET - NET CORE migration NUGET package buffer to the specified location

Migrate NuGet package to the specified location NuGet package originally stored: To migrate the place:   Specific operation: 1, new configuration: nuget.config   2, NuGet.config configuratio...

Develop .NET Core NuGet package and implement CI/CD

In actual development, we need to develop some public libraries, and based on Jenkins for CI/CD (CI: Continuous Integration, CD: Continuous Deployment), other projects are referenced by NuGet.AboveIt ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top