NuGet is a package manager for .NET. NuGet client tools provide the ability to build and use packages. As a .NET developer, you need to use NuGet to download packages frequently, and in order to improve the download speed of packages, you may use some domestic image sources to speed up the download. Previously, it was written that the image source of Blog Garden was used to speed up downloads, as follows:
Following Alibaba's open source mirror station (The hyperlink login is visible.), HUAWEI CLOUD Image Site (The hyperlink login is visible.After that, Tencent has also recently launched a similar service, officially named Tencent Open Source Mirror Site, to provide domestic developers with a new choice of software image sources.
To solve the problem of slow access speed to official sources when software is installed dependently, Tencent Cloud has built a caching service for some software. You can use the Tencent Cloud software origin server to speed up the installation of dependent packages. In order to facilitate users to freely build service architectures, Tencent Cloud software origin servers currently support public network access and private network access.
Public network access address:The hyperlink login is visible. Intranet access address:The hyperlink login is visible.
Nuget image address:The hyperlink login is visible. In 2017, Microsoft optimized the problem of slow access to Nuget services in China, backed up blob storage to China, and used a local CDN service provider to handle package download requests.The hyperlink login is visible.
The API of Nuget packages is divided into three categories: search, registration, and storage. The most frequently used are registration and storage APIs. Nuget images include cached reverse proxies to accelerate these APIs. Using this image can be used in Tencent Cloud and application development, the following acceleration effects can be achieved:
- For package searches: no acceleration effect. Search component packages are provided by additional domain names.
- Install, uninstall, upgrade packages, etc.: fully accelerated. All packet information is cached on the server on a daily basis, and the first access of each packet each day is a proxy access, followed by local access
- Package installation, upgrade, and download files: Fully accelerated. Each version of each package is downloaded for the first time for microproxy access, and then all packages with the same version and ID are accessed locally
Use the tutorial
Click "Tools" - "Options" in Visual Studio, find "Nuget Package Manager" - "Package Source" on the left, and confirm that your list contains the V3 version of the API (https://api.nuget.org/v3/index.json)。 Tencent Cloud's acceleration service only supports the V3 version of the package source, if there is no record of this, then you may not be able to use the acceleration service, please upgrade your Nuget package manager.
Click the Add button and enter your information below:
Name: Tencent Nuget
Package Address:The hyperlink login is visible.
Once entered, click the Update button to update, and finally confirm and close the configuration.
After the above settings, the relevant configuration is added to the Nuget configuration file, the file location is at: C:\Users\itsvse\AppData\Roaming\NuGet\Nuget.config, where itsvse is my computer account, change your account, the following is my Nuget configuration example:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> <add key="Tencent Nuget" value="https://mirrors.cloud.tencent.com/nuget/" /> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /> </packageSources> <packageRestore> <add key="enabled" value="True" /> <add key="automatic" value="True" /> </packageRestore> <bindingRedirects> <add key="skip" value="False" /> </bindingRedirects> <packageManagement> <add key="format" value="0" /> <add key="disabled" value="False" /> </packageManagement> </configuration>
We are all on Windows 10 for the above operations, especially to do. NET Core development, many students like to use Mac, if the path in Mac and Linux is, then the path is ~/.nuget/NuGet/NuGet.Config.
Note: The path of NuGet.Config in Windows is %appdata%\NuGet\NuGet.Config, and the path in Mac and Linux is ~/.nuget/NuGet/NuGet.Config, if there is no NuGet.Config file, you can run the dotnet restore command to generate.
When you use dotnet restore, you can also specify the use of Tencent Cloud image by –s.
(End)
|