【问题标题】:Is there a way to get a Service fabric project template for Stateless ASP.Net Core 2.1有没有办法获得无状态 ASP.Net Core 2.1 的服务结构项目模板
【发布时间】:2018-12-09 19:24:52
【问题描述】:

安装 .net core 2.1 sdk 后。当我使用 .net Core 创建 Service Fabric Stateless Service 时,它会使用 .net core 2.1 创建一个项目。同样,当我创建 Stateless Asp.net Core > API 时,创建的项目适用于 .net core 2.0。有没有办法获取 Stateless ASP.net Core 2.1 前端服务结构的最新模板?

【问题讨论】:

  • 你更新到最新的vs\sdk了吗?
  • 是的 VS 15.7.4 安装的 dotnet-sdk-2.1.301-win-x64.exe。从命令提示符 dotnet --version 2.1.301

标签: asp.net-core-2.0 azure-service-fabric


【解决方案1】:

有没有办法获取 Stateless ASP.net Core 2.1 前端服务结构的最新模板?

正如你提到的,目前似乎没有默认的.net core 2.1 service fabric 模板。

我也从 github 找到了类似的issue

但我们可以手动从 ASP.NET Core 2.0 迁移到 2.1。我在tutorial 之后做了一个演示。以下是详细步骤:

1.创建Asp.net core 2.0无状态服务

2.将框架从2.0改为2.1

3.使用以下代码编辑.csproj文件

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" PrivateAssets="All" />
    <PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="3.1.301" />
  </ItemGroup>
</Project>

3.在tutorial后面修改startup.cs文件

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-23
    • 1970-01-01
    • 1970-01-01
    • 2017-05-23
    • 1970-01-01
    • 2019-01-27
    • 2018-12-10
    相关资源
    最近更新 更多