如何为sl5目标框架构建一个SDK风格的项目

如何为sl5目标框架构建一个SDK风格的项目

本文介绍了如何为sl5目标框架构建一个SDK风格的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

According to https://docs.microsoft.com/en-us/dotnet/standard/frameworks sl5 is a supported target framework for an SDK style project.

我的项目文件是:

<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.AttributessrcDataSourceCodeGenerator.AttributesDataSourceCodeGenerator.Attributes.csproj (in 176 ms).
C:Program Filesdotnetsdk3.1.401SdksMicrosoft.NET.Sdk	argetsMicrosoft.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.AttributessrcDataSourceCodeGenerator.AttributesDataSourceCodeGenerator.Attributes.csproj]
  DataSourceCodeGenerator.Attributes -> C:DataSourceCodeGenerator.AttributessrcDataSourceCodeGenerator.AttributesinDebug
etstandard2.0DataSourceCodeGenerator.Attributes.dll

Build FAILED.

我可以构建任何可以被 Silverlight 项目识别的目标框架.所以,如果有 sl5 的替代方案 - 也可以.

I am OK to build any target framework that will be recognized by a Silverlight project. So, if there is an alternative to sl5 - that works too.

附言

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

Please, do not ask why I need to build a Silverlight project.

推荐答案

复制自评论.

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

Microsoft documentation can be inaccurate in certain pages, and I believe this is one of such pages.

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

You cannot use .NET Core SDK's default settings to multi target Silverlight platforms, but with some help from the open source MSBuild.Sdk.Extras you can achieve the same.

这篇关于如何为sl5目标框架构建一个SDK风格的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:25