简体   繁体   English

如何在VS 2017 RC中创建针对.NET Framework 4.5.1和.NET Standard 1.3的库?

[英]How should I create a library targetting .NET Framework 4.5.1 and .NET Standard 1.3 in VS 2017 RC?

This is my first time trying anything that targets more than just a .NET Framework. 这是我第一次尝试不仅仅针对.NET Framework的目标。 I can't seem to do it from the GUI. 我似乎无法从GUI做到这一点。 I've tried project type 'Class Library (Portable)' and project type 'Class Library (.NET Standard)'. 我已经尝试过项目类型为“类库(便携式)”,项目类型为“类库(.NET标准)”。 I can change a 'Class Library (Portable)' to target .NET Standard but then I can't select anything else. 我可以将“类库(可移植)”更改为目标.NET Standard,但随后我无法选择其他任何内容。 I'm not sure if I should try to change the .csproj of 'Class Library (.NET Standard)' or the project.json of 'Class Library (Portable)', I just want whatever is most future-proof. 我不确定是否应该尝试更改“类库(.NET标准)”的.csproj或“类库(可移植)”的project.json,我只是想要最适合未来的方法。

As of a few days ago the .csproj has been simplified and ease of use has improved. 几天前,.csproj已被简化,易用性得到了改善。 With the latest version of VS 2017 RC, I create such a library by creating a new 'Class Library (.NET Standard)', which has this default .csproj: 使用最新版本的VS 2017 RC,我通过创建一个新的'Class Library(.NET Standard)'创建了这样的库,该库具有以下默认.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.4</TargetFramework>
  </PropertyGroup>
</Project>

And I edit it by hand (I don't see a way to do it through the UI) to be this: 我手动编辑它(我看不到通过UI进行编辑的方法)是这样的:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard1.3;net452</TargetFrameworks>
  </PropertyGroup>
</Project>

The 'Target framework' drop down under the project's Properties pane then becomes grayed out. 然后,项目的“属性”窗格下的“目标框架”下拉框将变为灰色。 By building you can verify separate netstandard1.3 and net452 folders under bin\\Debug. 通过构建,您可以在bin \\ Debug下验证单独的netstandard1.3和net452文件夹。 Be aware of the following issue if you're creating a NuGet package on build, which may mislead you into thinking you've done something incorrectly: https://github.com/NuGet/Home/issues/4289 . 如果要在构建中创建NuGet软件包,请注意以下问题,这可能会误导您以为您做错了什么: https : //github.com/NuGet/Home/issues/4289

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在VS 2017 RC中创建.NET标准类库时,应如何保留包引用作为私有实现详细信息? - When creating a .NET Standard Class Library in VS 2017 RC, how should I keep package references as private implementation details? 如何在VS 2013中包括.net Framework 4.5.1 - How to include .net framework 4.5.1 in VS 2013 Library Targetting .NET 4.5.1和Windows 8.1 / WP8.1中的套接字 - Sockets in Library Targetting .NET 4.5.1 and Windows 8.1/WP8.1 如何在VS 2017中创建具有最小依赖性的.NET Standard NuGet包? - How to create .NET Standard NuGet package with minimal dependencies in VS 2017? 如何将 .NET 标准库更改为 .NET 框架库? - How can I change a .NET standard library to a .NET framework library? 如何在Visual Studio 2017中添加.Net框架4.6.1类库而不是.Net标准? - How to add .Net framework 4.6.1 Class Library instead of .Net standard in Visual Studio 2017? 如何从Visual Studio 2017中的.NET Framework 4.5控制台应用程序引用.NET标准库? - How Do You Reference a .NET Standard Library from a .NET Framework 4.5 Console Application in Visual Studio 2017? 如何使用.NET Standard 2.0作为目标框架创建F#库? - How to create an F# library with target framework as .NET Standard 2.0? 如何使用来自 Rider 或 VS 2017 的 NUnit、xUnit 或 MSTest 测试 .NET Standard 2 库? - How to test .NET Standard 2 library with either NUnit, xUnit or MSTest from either Rider or VS 2017? .Net Framework 4.5.1 RemoveAt - .Net Framework 4.5.1 RemoveAt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM