如何为sl5目标框架构建SDK风格的项目? 参考文献

问题描述

根据https://docs.microsoft.com/en-us/dotnet/standard/frameworks sl5是SDK样式项目支持的目标框架。

我的项目文件是:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;sl5</TargetFrameworks>
  </PropertyGroup>
</Project>

但是,我无法构建它:

C:\DataSourceCodeGenerator.Attributes [master ≡ +0 ~1 -0 !]> dotnet build                                                                                                  Microsoft (R) Build Engine version 16.7.0+b89cb5fde for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored C:\DataSourceCodeGenerator.Attributes\src\DataSourceCodeGenerator.Attributes\DataSourceCodeGenerator.Attributes.csproj (in 176 ms).
C:\Program Files\dotnet\sdk\3.1.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(93,5): error NETSDK1013: The TargetFramework value 'sl5' was not recognized. It may be misspelled. If not,then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. [C:\DataSourceCodeGenerator.Attributes\src\DataSourceCodeGenerator.Attributes\DataSourceCodeGenerator.Attributes.csproj]
  DataSourceCodeGenerator.Attributes -> C:\DataSourceCodeGenerator.Attributes\src\DataSourceCodeGenerator.Attributes\bin\Debug\netstandard2.0\DataSourceCodeGenerator.Attributes.dll

Build FAILED.

我可以构建任何Silverlight项目可以识别的目标框架。因此,如果有sl5的替代方案,那么也可以。

P.S。

请不要问为什么我需要构建一个Silverlight项目。

解决方法

从评论中复制。

Microsoft文档在某些页面中可能不准确,我相信这是此类页面之一。

您不能将.NET Core SDK的默认设置用于多目标Silverlight平台,但是在开源MSBuild.Sdk.Extras的帮助下,您可以实现相同的目标。

参考文献

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...