【问题标题】:Converting netcore2.2 -> netstandard2: The runcommand property is not defined转换 netcore2.2 -> netstandard2:runco​​mmand 属性未定义
【发布时间】:2019-10-21 00:36:34
【问题描述】:

我正在将我的netcore2.2 应用程序转换为netstandard2.0;net472

这是我主要项目的csproj 文件:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <Platforms>AnyCPU;x64</Platforms>
    <StartupObject></StartupObject>
    <ApplicationIcon />
    <OutputType>WinExe</OutputType>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>

  <ItemGroup>
        <PackageReference Include="JWT" Version="5.3.1" />
        <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.CookiePolicy" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.2.0" />
        <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
        <PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="2.2.0" />
        <PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.6" />
    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.5.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
    <PackageReference Include="swashbuckle.aspnetcore" Version="4.0.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\mvaasa.repository\mvaasa.repository.csproj" />
    <ProjectReference Include="..\mvaasa.services\mvaasa.services.csproj" />
  </ItemGroup>

</Project>

这是我的Application Settings

每当我尝试Start Debugging (IIS Express) 时,都会弹出以下错误消息:

如何设置?

更新

我尝试将OutputType 设置为Exe,如下所示:

<OutputType>Exe</OutputType>

【问题讨论】:

标签: visual-studio .net-standard


【解决方案1】:

.NET Standard 不是生成可运行程序集的目标框架。而是以 .NET Core 为目标,以便能够在实际运行时上运行。

定位netstandard2.0 仅对库有用,对您要运行的程序无效。

当您针对多个框架时,还要确保您传递了预期的运行时以在其上运行:

dotnet run -f netcoreapp2.2

【讨论】:

    猜你喜欢
    • 2018-06-06
    • 1970-01-01
    • 1970-01-01
    • 2011-05-13
    • 2013-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-30
    相关资源
    最近更新 更多