zoukankan      html  css  js  c++  java
  • 2019-2-18-VisualStudio-给项目添加特殊的-Nuget-的链接

    title author date CreateTime categories
    VisualStudio 给项目添加特殊的 Nuget 的链接
    lindexi
    2019-02-18 15:56:48 +0800
    2019-02-18 15:56:36 +0800
    VisualStudio

    有一些项目需要使用一些特殊的 Nuget 才可以下载,但是不能在开源的项目需要小伙伴下载仓库在自己的 VisualStudio 修改自己的 Nuget 链接才能编译,本文告诉大家将某个项目独立的 Nuget 配置放在一个文件

    如果有安装 dotnet core 的小伙伴,只需要在项目所在的文件夹输入下面代码就可以创建 Nuget 配置文件

    dotnet new nuget

    就可以看到在 csproj 文件所在的文件夹看到 nuget.config 文件,里面大概有下面代码

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     <packageSources>
        <!--To inherit the global NuGet package sources remove the <clear/> line below -->
        <clear />
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
     </packageSources>
    </configuration>
    
    

    假如我需要通过 myget 下载一些没发布的库,可以在这个文件做下面的修改

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     <packageSources>
        <!--To inherit the global NuGet package sources remove the <clear/> line below -->
        <clear />
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
        <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
     </packageSources>
    </configuration>
    
    

    但是我自己全局也有一些特殊的 Nuget 库,这时就可以将 clear 去掉

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     <packageSources>
        <!--To inherit the global NuGet package sources remove the <clear/> line below -->
        <!-- <clear /> 取消注释将会让全局的配置失效,被清空,只使用下面定义的 Nuget 下载-->
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
        <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
     </packageSources>
    </configuration>
    
    
  • 相关阅读:
    hdu 2544 单源最短路问题 dijkstra+堆优化模板
    CImg、libjpeg--介绍、配置(操作JPEG)
    【Android归纳】开发中应该注意的事项
    iOS測试——置换測试: Mock, Stub 和其它
    <html>
    系统吞吐量、TPS(QPS)、用户并发量、性能測试概念和公式
    hdu 1038 Biker&#39;s Trip Odometer(水题)
    java泛型
    从头认识Spring-2.1 自己主动装配(2)-byType(2)
    11.2.0.3 RAC(VCS)节点crash以及hang的问题分析
  • 原文地址:https://www.cnblogs.com/lindexi/p/12085784.html
Copyright © 2011-2022 走看看