.net-standard

Which .NET versions should be supported by NuGet packages to maximize their availability and functionality?

末鹿安然 提交于 2019-11-29 06:12:29
问题 TL;DR: Given: I wrote a library with relatively portable functionality (for example, Left.Pad.©.dll ). I want to make it available though NuGet. Requirement: If somebody wants to use my library on any version of any platform on any version of any operating system with any updates installed by writing code in any IDE or any code editor, they should be able to do it. Question: What is the minimum set of NuGet target frameworks to achieve that? Bonus question: If there're any "dead" frameworks

What do Yellow Warning Triangles mean on Dependencies in Visual Studio 2017?

孤街浪徒 提交于 2019-11-29 05:25:36
I have just converted my PCL library to a new .Net Standard library and I have some Yellow Warning triangles on my Dependencies shown below: During the conversion it brought all nuget packages across including dependencies so it could be dulicates. How do I find out what the Yellow warning triangles represent? EDIT Build Logs: To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.' NU1605: Detected package downgrade: NUnit from 3.8.1 to 2.6.4. Reference

Convert .NET Core 2.0 class libraries to .NET Standard

我的未来我决定 提交于 2019-11-29 02:04:56
问题 Is there a way to easily convert a class library targeting .NET Core 2.0 to .NET Standard? If I understand it correctly, if one wants to maximize the reusability of class libraries in projects targeting different .NET frameworks e.g. .NET Framework, .NET Core, Xamarin, etc., it's a better idea to target .NET Standard -- provided that all the required APIs are available in the version of .NET Standard that will be targeted. This is the reason why I want to convert my class libraries from .NET

Could not load file or assembly “System.ValueTuple, Version=0.0.0.0” or one of its dependencies

流过昼夜 提交于 2019-11-28 23:11:23
I tried to update my project to .NET Standard 2.0 and during testing I got catch an exception: System.IO.FileLoadException: 'Could not load file or assembly "System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" or one of its dependencies. The definition of the assembly manifest found does not match the reference to the assembly. This is assambly exists in package.config and exists on the package's folder. I tried some versions of System.ValueTuple package, result is one. Why the version of dependencies «0.0.0.0»? Does anyone have an idea about the problem? VS

How to properly unit test a .NET project with multiple target frameworks, given implementation differences among targets?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 21:07:54
问题 Consider a .NET class library that targets the following frameworks: .NET Framework 2.0 .NET Framework 4.6 .NET Standard 1.0 .NET Standard 1.3 .NET Portable Profile336 Let's not immediately worry about why this is the exact list of target frameworks. Supposing that the external API across all target frameworks is identical, but each individual target framework has some code that's unique to that framework, how do I properly write the unit tests that cover the code from all target frameworks?

Is ConfigurationManager.AppSettings available in .NET Core 2.0?

安稳与你 提交于 2019-11-28 18:30:26
I've got a method that reads settings from my config file like this: var value = ConfigurationManager.AppSettings[key]; It compiles fine when targeting .NET Standard 2.0 only. Now I need multiple targets, so I updated my project file with: <TargetFrameworks>netcoreapp2.0;net461;netstandard2.0</TargetFrameworks> But now, the compilation fails for netcoreapp2.0 with the following error message: Error CS0103 The name 'ConfigurationManager' does not exist in the current context (netcoreapp2.0) Separately, I created a new .NET Core 2.0 console application (only targeting .NET Core 2.0 this time),

Unit testing internal methods in VS2017 .Net Standard library

你说的曾经没有我的故事 提交于 2019-11-28 17:15:47
问题 I am currently playing around with the latest Visual Studio 2017 Release Candidate by creating a .Net Standard 1.6 library. I am using xUnit to unit test my code and was wondering if you can still testing internal methods in VS2017. I remember that you could all a line AssemblyInfo.cs class in VS2015 that would enable specified projects to see internal methods [assembly:InternalsVisibleTo("MyTests")] As there is no AssemblyInfo.cs class in VS2017 .Net Standard projects I was wondering if you

Should I take ILogger, ILogger<T>, ILoggerFactory or ILoggerProvider for a library?

坚强是说给别人听的谎言 提交于 2019-11-28 16:36:54
This may be somewhat related to Pass ILogger or ILoggerFactory to constructors in AspNet Core? , however this is specifically about Library Design , not about how the actual application that uses those libraries implement its logging. I am writing a .net Standard 2.0 Library that will be installed via Nuget, and to allow people using that Library to get some debug info, I'm depending on Microsoft.Extensions.Logging.Abstractions to allow a standardized Logger to be injected. However, I'm seeing multiple interfaces, and sample code on the web sometimes uses ILoggerFactory and creates a logger in

Can I add .NET Standard libraries to PCL

陌路散爱 提交于 2019-11-28 11:39:13
问题 I have a Xamarin Forms app and using Visual Studio 2015. 1) Can I add to PCL .NET Standard libraries? Are there any issues with that? 2) Editing resx of a .NET Standard library crashes VS2015. Any workaround? 回答1: You can add .Net standard libraries to PCLs, but only lower versions. It depends on your profile version, so you almost have to try it and see if it works. You can add PCLs to .Net standard libraries, by setting a fallback to the PCL in your csproj file. You can read about it here:

Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0

梦想与她 提交于 2019-11-28 08:02:00
I have a .NET Standard 1.4 class library that references the System.ComponentModel.Annotations (4.3.0) NuGet package. I'm then referencing this class library from a .NET Framework 4.6.2 test project. It builds fine, but at runtime I get the following error: System.IO.FileLoadException occurred HResult=0x80131040 Message= Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: