VS 代码 + 开发(Linux)+ 目标(.net Framework)+ 主机(Windows)
VS Code + Develop(Linux) + Target(.net Framework) + Host(Windows)
我正在 Visual Studio Linux 上使用 ASPNET Core 2.0 开发 Web 应用程序。但是我尝试部署应用程序的主机是 Windows 服务器,唯一可用的目标选项是 .Net Framework 4.6。
所以,当我尝试 运行 dotnet publish -o /folder -f net461
它向我显示
this error.
是否可以使用 .Net Framework 在 linux 上开发 aspnet 核心应用程序并在 windows 上部署它?
错误正文如下:
/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/maransatto/Projects/FATEC/EraDoConhecimento/web/BDAg.csproj]
有 2 种方案:ASP.Net Core with .Net framework 和 ASP.Net Core with .Net Core。您无法在 linux 上使用 .net 框架开发 asp.net 核心,因此您的应用程序的目标可能是 "netcoreapp2.0"(假设您下载了最新版本)。您可以仅使用 .net core runtime 2.0 在 windows 服务器上部署您的应用程序。
你的命令应该是
dotnet publish -c Release -f netcoreapp2.0
您可以部署依赖于框架或自包含的版本。参见 (https://docs.microsoft.com/en-us/dotnet/core/deploying/index)。
您还需要 Asp.Net windows 核心模块与 IIS 集成。
https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
发布自包含时,您不需要在服务器上安装 .net 核心。
我正在 Visual Studio Linux 上使用 ASPNET Core 2.0 开发 Web 应用程序。但是我尝试部署应用程序的主机是 Windows 服务器,唯一可用的目标选项是 .Net Framework 4.6。
所以,当我尝试 运行 dotnet publish -o /folder -f net461
它向我显示
this error.
是否可以使用 .Net Framework 在 linux 上开发 aspnet 核心应用程序并在 windows 上部署它?
错误正文如下:
/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/maransatto/Projects/FATEC/EraDoConhecimento/web/BDAg.csproj]
有 2 种方案:ASP.Net Core with .Net framework 和 ASP.Net Core with .Net Core。您无法在 linux 上使用 .net 框架开发 asp.net 核心,因此您的应用程序的目标可能是 "netcoreapp2.0"(假设您下载了最新版本)。您可以仅使用 .net core runtime 2.0 在 windows 服务器上部署您的应用程序。
你的命令应该是
dotnet publish -c Release -f netcoreapp2.0
您可以部署依赖于框架或自包含的版本。参见 (https://docs.microsoft.com/en-us/dotnet/core/deploying/index)。
您还需要 Asp.Net windows 核心模块与 IIS 集成。 https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
发布自包含时,您不需要在服务器上安装 .net 核心。