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>
    
    
  • 相关阅读:
    Lilo的实现
    通过Bochs分析Lilo启动Linux内核的过程
    Linux内核代码布局
    Linux启动过程的内核代码分析
    Linux启动过程的C语言代码分析
    Linux操作系统中对于NTFS读取目录功能的实现
    Linux初始化的汇编代码
    Linux文件映射的反思
    Xen的概况
    安装debian总结以及编译linux内核
  • 原文地址:https://www.cnblogs.com/lindexi/p/12085784.html
Copyright © 2011-2022 走看看