希格工作室

2020年12月14日 星期一

.Net Core 各版本並存測試

 自問:



自答:









移除指令眉角:

--all後面還是要接要移除哪一種東西,Runtime就要打--runtime、 Hosting Bundle就要打上--hosting-bundle


顯示目前已安裝且可移除的版本

dotnet-core-uninstall list


移除所有runtime版本

dotnet-core-uninstall remove --all --runtime -y

移除除指定版本以外所有的runtime

dotnet-core-uninstall remove --all-but 3.1.10 --runtime -y


移除所有Hosting Bundle版本

dotnet-core-uninstall remove --all --hosting-bundle -y

移除除指定版本以外所有的Hosting Bundle

dotnet-core-uninstall remove --all-but 3.1.10 --hosting-bundle -y



總結:

.Net Core各版本理論上並存在服務器上沒什麼問題

只是如果要移除其他版本時就要注意

如果環境是IIS,且使用的是Hosting Bundle版本進行的安裝





移除時,不可以移除到Hosting Bundle

否則雖然--info還是看得到3.1存在,但是3.1也會不能運作

需要重新安裝Hosting Bundle進行修復才會恢復正常





.Net Core移除工具:https://docs.microsoft.com/zh-tw/dotnet/core/additional-tools/uninstall-tool?tabs=windows