【问题标题】:How to build an SDK style project for the sl5 target framework?如何为 sl5 目标框架构建 SDK 风格的项目?
【发布时间】:2020-12-06 22:18:29
【问题描述】:

根据https://docs.microsoft.com/en-us/dotnet/standard/frameworkssl5 是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 的替代品 - 也可以。

附言

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

【问题讨论】:

标签: c# .net-core silverlight


【解决方案1】:

从 cmets 复制。

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

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

参考文献

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-27
    • 2022-08-16
    • 2015-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多