Centos升級安裝.Net core 1.1


    VS2017已經發布了一個多月了,最期待的功能就是.net core的更新,終於去掉了繁瑣了project.json的文件配置。我們嘗試打開一個VS2015的.net core項目,會自動升級至.net core 1.1並去掉了project.json文件。

    這是一個好事情,感覺上和開發傳統的項目更接近了一點。在對現有的項目進行了升級,自然而然就會要部署到服務器環境,但是當直接運行的話會出錯

很明顯是提示.net core 的版本不對,要求我們升級服務器的.net core版本。原先部署.net core環境可以參考: 將ASP.NET Core應用程序部署至生產環境中(CentOS7)

 

那么.net core 1.1要如何升級?

    我們打開微軟官方的 .NET Core installation guide,發現安裝方法和之前的一模一樣:

sudo yum install libunwind libicu
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=843449
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

那么最直接的方法就是把最新的tar.gz文件下來了,然后覆蓋安裝在原來的/opt/dotnet下面,

覆蓋前:

 

覆蓋后:

可以看到版本是升級了。

 

這樣升級之后對之前的1.0的應用有沒有影響?

而且在MSDN微軟的這篇博客里 Announcing .NET Core 1.1有如下描述:

Using .NET Core 1.1

You can start by installing .NET Core 1.1. You can either install it globally using the .NET Core 1.1 installer or package manager for your operating system or try it an isolated (and easily removable) environment by downloading .NET Core as a zip.

Safe side-by-side install

You can safely globally install .NET Core 1.1 on a machine that already has .NET Core 1.0.

The dotnet new command creates new templates that reference the latest runtime on the machine. This may not be desired. If not, you can hand-edit the versions in the resulting project.json to earlier version numbers. Based on feedback, we will be changing this behavior in the new version of the tools, at the same time we release the final version of Visual Studio 2017. If you do not use dotnet new to create new projects, but rely on Visual Studio, then you are not affected.

明確說明.net core 1.1 不會影響原有的1.0的程序。為了驗證(不做測試還是不敢上產線啊),我用原來的1.0的程序在1.1上面跑,實測完全沒問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM