如何为sl5目标框架构建SDK风格的项目? [英] How to build an SDK style project for the sl5 target framework?

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

问题描述

根据 https://docs.microsoft.com/zh-CN/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.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的替代方法,它也可以使用.

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.

P.S.

请不要问为什么我需要构建一个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.

  • https://github.com/dotnet/sdk/issues/8779
  • https://github.com/novotnyllc/MSBuildSdkExtras

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆