Manually set up your own server and use nuget

The main purpose of this article:

1. build their own proprietary server nuget

2. Packing code packet nuget

3. Use nuget private server packages on other projects

A. Nuget build their own server

1. Create an empty ASP.NET Web application

2. Use nuget Manager, add nuget.server package

After successful installation, the following directory structure of FIG.

3. Right-generated site on the project and run

Results are as follows:

 

As can be seen from the figure, Cause:

There duplicate node error web.config

4. Modify Error in web.config node: Remove duplicate nodes compilation i.e. 

 

 Delete the following compilation node

5. Re-compile, build websites, and running

Click here

As indicated above, the successful set up server nuget

Then, publish the project to the local IIS server

appendix:

Here attached release of IIS

(1) Right project, released

(2) Select the folder, and set up a delivery route

 

(3) Click the Publish button in the previous step

As shown, publishing success

(4) Add the website in IIS

(5) You can do the following configuration, click OK

Note When you click OK, make sure that the appropriate application in the application pool is version 4.0

That is, the modification is 2.0 to 4.0

(6) browser.  HTTP: // localhost: 8090 / 

 

Click on the first here

As above, the successful deployment site in IIS

II. Nuget packaged as the code packet

1. Right-click the solution, add new projects

2 below, was added Library

3. Right ClassLibrary1 library, click Generate

4. where the file into the project folder, and copy the folder to nuget.exe

Note: nuget.exe download path, in which

Above, and enter the command cmd directory

 5. In the directory, the operation command cmd

 After the transport, the following indicates successful generation

Meanwhile, the folder, file one more .nupkg

6. Now nuget package already laid the

However, if we want to have this package on our private nuget server, we also need to .nuget files to our private nuget server;

如果有需要,可以自己在nuget私有服务器项目中添加一个上传功能,这里选择简单方式。

即直接把打包生成的.nuget文件直接复制粘贴到 nuget服务器的 Packages 文件夹下,

这里的路径为:G:\Dot_NET\wwwroot\nugetserverdemo\Packages

 

得到上图,

综上,ClassLibrary1的nuget包就已经在我们的nuget服务器上了。

访问网站,点击第一个here,可以得到,如下:

 

三. 在其他项目中,使用我们私有nuget服务器上的nuget包

 1. 右键解决方案,添加一个新的项目

选择ASP.NET Web应用程序 ,项目名称 NugetTest

选择mvc

最后,点击确认

2. 进入nuget包管理器,配置程序包源

 如下,把本地nuget私有服务器地址添加

3.选择 private nuget.test 源,如下

 可以正常显示nuget私有服务器上的ClassLibrary1的nuget包,故这里就算成功了。

四. 最后,这里再说下,自己的一些尝试结果

1. 在搭建nuget私有服务器时,因为有nuget.server.core,所以,刚开始,有试过创建dotnet core 的版本,但是显示的有部分不兼容。所以,直接就放弃了,没有试验。

2. 还有就是中间,在搭建nuget私有服务器时,有尝试创建 以前老版本的ASP.NET 空网址,但是在引入nuget.server 3.x 版本以后,虽然,网站建立起来了,

 但是,点击网站的第一个here时,并不能正常访问,所以,也失败。

3 . 还有就是刚开始,在IIS上部署的时候,部署会报500的错误,也浪费了一些时间,之后我尝试建的asp.net core webapi项目发布到IIS后,也会报错,

这里只说下解决的办法,因为本机环境dotnet core 2.2 版本,之前装的runtime版本是2.1.6 ,在发布到IIS以后,不知道什么原因有500的错误;之后下载最近的hosting 2.2.5版本,IIS终于可以正常了。

 

注意:如果你的IIS在部署dotnet core项目时,出现问题,可以尝试下载最新的 runtime 试试 能否解决 ,这里给出 地址

Guess you like

Origin www.cnblogs.com/Vincent-yuan/p/11129909.html