• 简单搭建 nuget 内部服务器


    搭建 nuget 内部服务器,最好的方式是使用 ProGet,参考博文《用 ProGet 搭建内部的 NuGet 服务器》,好处非常多,但需要使用 SQL Server 数据库,如果不想使用数据库,相对来说,最简单的方式是使用NuGet.Server,网上教程一大堆,这边我做下自己的记录。

    首先,VS 创建一个空的 ASP.NET 应用程序,然后 nuget 命令输入install-package NuGet.Server,接着会自动加载一些代码和文件,其中在 web.config 中会产生这样的配置:

    <configuration>
      <appSettings>
        <!--
        Determines if an Api Key is required to pushdelete packages from the server. 
        -->
        <add key="requireApiKey" value="true"/>
        <!-- 
        Set the value here to allow people to push/delete packages from the server.
        NOTE: This is a shared key (password) for all users.
        -->
        <add key="apiKey" value="123456"/>
        <!--
        Change the path to the packages folder. Default is ~/Packages.
        This can be a virtual or physical path.
        -->
        <add key="packagesPath" value=""/>
        <!--
        Set allowOverrideExistingPackageOnPush to false to mimic NuGet.org's behaviour (do not allow overwriting packages with same id + version).
        -->
        <add key="allowOverrideExistingPackageOnPush" value="false"/>
        <!--
        Set ignoreSymbolsPackages to true to filter out symbols packages. Since NuGet.Server does not come with a symbol server,
        it makes sense to ignore this type of packages. When enabled, files named `.symbols.nupkg` or packages containing a `/src` folder will be ignored.
        
        If you only push .symbols.nupkg packages, set this to false so that packages can be uploaded.
        -->
        <add key="ignoreSymbolsPackages" value="true"/>
      </appSettings>
    <configuration>
    

    其中最常用的是 apiKey 和 packagesPath,apiKey 是发布的 key,后面发布 nuget package 的时候会用到,packagesPath 是配置 package 的目录,默认目录是 ~/Packages。

    nuget 内部服务器的发布和其他 ASP.NET 站点发布一样,直接发布在 IIS 上就可以了。

    nuget package 的发布工具,可以使用 NuGet Package Explorer,下载地址:https://npe.codeplex.com

    使用简单示例:

    nuget package 发布完之后,就可以在项目中安装使用了,首先在 VS 中配置内部 nuget 服务器源,比如 http://10.10.10.10:8001/nuget,接下来就。。。

  • 相关阅读:
    8.Http的状态码有哪些
    6、<!DOCTYPE>声明是什么意思
    6.px和em的区别
    5、什么叫优雅降级和渐进增强
    3、简述src和href的区别;@import和link的区别
    2、行内元素有哪些?块级元素有哪些? 空(void)元素有那些?行内元素和块级元素有什么区别?
    1、盒模型理解
    requests学习(一)——get请求
    【Flutter】功能型组件之跨组件状态共享
    【Flutter】功能型组件之数据共享
  • 原文地址:https://www.cnblogs.com/xishuai/p/nuget-server.html
Copyright © 2020-2023  润新知