Use. NET Core in offline environments and. netcore in offline environments

Source: Internet
Author: User

Use. NET Core in offline environments and. netcore in offline environments
Use. NET Core0x00 in offline environment to write at the beginning

I have been paying close attention to. NET Core for a long time. Microsoft's previous impressions have become lightweight, open-source, and cross-platform. I plan to try it at work recently. However, the work is carried out in a completely isolated network from the Internet, So it started an attempt to deploy the. NET Core development environment in an offline environment. In general, it is still quite painful, and almost every stage has encountered problems. But it's okay to get it done. Write down this blog and share it with kids shoes with similar needs. The following are all for test purposes.

0x01 install VS2015 Update3

Development. NET Core can use VS2015 and VS Code. Here we will first discuss the situation of VS2015. After all, if it is developed in Windows, VS2015 features will be much stronger .. NET Core Web Tools must be VS2015 Update3 or above, that is, VS2015 Update3 must be installed on the Intranet first. I first downloaded the CD image from the official website and then installed it. However, in most cases, installation fails. The system will prompt "the installation package is lost or damaged". You can skip the file when installing VS2015, and it can also be used after installation (at least WPF is okay), but it starts from VS2015 Update2, some installation packages cannot be skipped. You can only exit installation.

The installation package is corrupted because it is missing

Microsoft root certificate authorization 2010

Microsoft root certificate authorization 2011

These two certificates cause the installation package to fail verification and are considered corrupt.

Solution:

1. Find a computer with VS2015 installed normally. Open Win + R and enter certmgr. msc to open the certificate management interface.

2. Find the two missing items in the Trusted Root Certificate Authority. Export data by default (I don't know why I have repeated data on this computer ).

3. Copy the certificate to the Intranet, open the certificate management interface, and then import the certificate in a trusted root certificate authority.

In this way, you can install VS2015 Update3 normally.

In addition to downloading the VS2015 Update3 CD image, you can also download the Installation File offline and test the installation file to the offline environment for installation. Download the Web installer on the official download page.

Https://www.visualstudio.com/downloads/download-visual-studio-vs

Take the community version as an example. Open the command line window in the directory where the installer is located, and enter vs_community_CHS.exe/layout to take the files offline. It seems that the content of the files is more than that of the CD image.

0x02 install DotNetCore.1.0.0-VS2015Tools. Preview2

This method can be used offline in the same way as VS2015. After downloading the online installer, open the command line window in the directory where the installer is located and enter:

DotNetCore.1.0.0-VS2015Tools.Preview2.exe/layout

You can download the installation file to the packages folder in the same directory, which also contains the. Net Core SDK. What's worse is that my Intranet computer has installed a domestic antivirus software. Every time I run the installation, I am prompted to perform malicious operations and forcibly stop the installation. I have no permission to disable the antivirus software, therefore, you have to manually install the package one by one, but it can be used normally. This is because the offline environment is always lacking. If any problem occurs during installation, you only need to check the error log and solve the problem.

0x03 how to use nuget

All. NET Core packages depend on nuget, which is convenient in the online environment and a little troublesome in the offline environment. When installing VS2015 Update3 ,. the official dependency packages required by NET Core have been installed in the (default installation) C: \ Program Files (x86) \ Microsoft SDKs \ NuGetPackages directory, in nuget management, you can also see that this is the default offline package directory. You only need to copy the package to this directory and select the offline package source in nuget management.

So how can we get the offline installation package? When we use nuget to install the package, we will go to C: \ Users \ {your username }\. the nuget \ packages directory is cached. You only need to copy the cached package to the offline environment and put it in the nuget offline directory.

Another way is to set up the nuget service on the Intranet. This is also very easy,

Http://edi.wang/Post/2012/12/15/setup-private-nuget-server

For more information, see. Considering that the. NET Core to be used is relatively new, the latest NugetServer I use can be used, but other versions have not been tried. After the service is set up, you can add a new package source in nuget management.

In this way, you can also add package dependencies for other projects (such as WPF.

0x04 development with VS Code

In addition to VS, you can also use VS Code for development. NET Core, my method is to download VS Code on a computer that can be connected to the Internet, and then install a bunch of required plug-ins, all installed in C: \ Users \ {your username }\. in the vscode \ extensions directory, you only need to package the directory to the offline environment and decompress it to the same directory.

In addition, when developing a dotnet restore with VS Code, you need to add the-s parameter to specify the package Source: dotnet restore-s package directory. Or add the nuget. config file to the root directory of the project.

This file can be downloaded on github: https://github.com/aspnet/Home/blob/dev/samples/latest/HelloMvc/NuGet.Config

<?xml version="1.0" encoding="utf-8"?><configuration>  <packageSources>    <clear />    <add key="AspNetVNext" value="https://www.myget.org/F/aspnetvnext/api/v2" />    <add key="NuGetorg" value="https://nuget.org/api/v2/" />  </packageSources></configuration>

Add your own package source in packageSources.

0x05 written at the end

The whole process took some time, and it was quite depressing for several times. But I really want to try something with. NET Core in my work environment. Fortunately, it was done. I think it's a little excited.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.