.net-standard

Does .NET Standard normalize HResult values across every platform it supports?

你说的曾经没有我的故事 提交于 2019-11-28 03:55:24
问题 I am creating a simple function that creates a random file. To be thread safe, it creates the file in a retry loop and if the file exists it tries again. while (true) { fileName = NewTempFileName(prefix, suffix, directory); if (File.Exists(fileName)) { continue; } try { // Create the file, and close it immediately using (var stream = new FileStream(fileName, FileMode.CreateNew, FileAccess.Write, FileShare.Read)) { break; } } catch (IOException e) { // If the error was because the file exists,

Azure Function gives error: System.Drawing is not supported on this platform

久未见 提交于 2019-11-28 00:51:36
(If this question is poorly worded, could someone please help me clear it up?) I have an Azure Function (2.0) which relies on some System.Drawing code. I've added a NuGet reference to System.Drawing.Common (4.5.0). After publishing the app, however, when the function is called, it produces the error: System.Private.CoreLib: Exception while executing function: [MyFunctionName]. System.Drawing.Common: System.Drawing is not supported on this platform. As far as I'm aware, System.Drawing.Common is supported on .NET Core now, which I believe is the environment in which my Azure Function is running.

Using .net standard 1.5 lib in .net 4.6.2 misses System.Runtime 4.1.0.0

给你一囗甜甜゛ 提交于 2019-11-27 14:29:05
I've some problem when using .net standard in .net framework 4.6.2 consoleapps. I could reduce the problem to this: Given: I create a .net standard 1.5 client library vis vs 2017 with this single class public class Class1 { public List<int> Get() { return new List<int>() { 1, 2, 3, 4, 5, 65, 6 }; } } Now I create a new .net 4.6.2 console application which is just calling the method of this class: static void Main(string[] args) { var foo = new Class1(); Console.WriteLine("Done!"); Console.ReadLine(); } Now I get System.IO.FileNotFoundException: 'The File or Assembly "System.Runtime, Version=4

Type 'Object' is defined in an assembly that is not referenced (NET Standard 2.0/.NET Framework 4.6.1)

喜欢而已 提交于 2019-11-27 14:21:50
问题 I'm using the .NET Standard 2.0 preview, on which my Class Libraries are based. After having trouble with a few NuGet packages, especially regarding archive extraction, I decided to migrate my .NET Core 2.0 Console projects back to the .NET Framework 4.6.1. The .NET Framework 4.6.1 is supposed to implement the .NET Standard 2.0 specification - according to different sources. Especially the dotnet/standard GitHub Repo. Unfortunately, the migration to the .NET Framework resulted in the

Referencing a .NET Standard library from a Windows Class Library

喜夏-厌秋 提交于 2019-11-27 13:01:10
问题 There are two projects in my solution currently: a Windows Class Library (targeting .NET Framework 4.6.1) and another class library that targets .NET Standard 1.3. I'm using Visual Studio 2015 Update 3. I've added a reference to the .NET Standard project from the other project and it appears in the list of references, but I can't see any of the classes or namespaces from the referenced library when I want to use them (even though the referenced library was successfully built and has no errors

.NET Standard vs .NET Core

纵然是瞬间 提交于 2019-11-27 10:01:57
I have read about the difference between .NET Standard and .NET Core, but I really don't know what the difference is, or when to choose a .NET Standard library project and when to choose a .NET Core library project. I have read that .NET Standard is to ensure that a set of APIs are always available, no matter the platform used (as long as that platform is compatible with the .NET Standard version that I have chosen). If I'm not mistaken, this means that I can create a class library of .NET Standard and then use it on any platform that is compatible with the .NET Standard version that I have

How to authenticate without prompt to CRM Dynamics Online webservices with ADAL, NetStandard, and Azure AD

蹲街弑〆低调 提交于 2019-11-27 07:25:30
问题 I'm currently trying to create a Xamarin App in order to get some info from a Dynamics 365 online instance. The code that authenticate with AD and access the CRM api is deported in a NetStandard (v1.6) Library. I use the following NuGets : Microsoft.IdentityModel.Clients.ActiveDirectory (3.13.9) NETStandard.Library (1.6.1) I followed the following tutorial in order to link AD with my Dynamics instance : https://nishantrana.me/2016/11/13/register-a-dynamics-365-app-with-azure-active-directory/

Installing a .NetStandard 2.0 Nuget package into a VS2015 Net 4.6.1 project

南笙酒味 提交于 2019-11-27 03:18:38
问题 I'm trying to install a Nuget package that targets .NetStandard 2.0 (Microsoft.Extensions.Logging.Abstractions) into a Net 4.6.1 project in Visual Studio 2015. However, while Frameworks should be compatible, it doesn't quite work: Install-Package : Could not install package 'Microsoft.Extensions.Logging.Abstractions 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content

Compatibility shim used by .NET Standard 2.0

冷暖自知 提交于 2019-11-27 01:25:59
Overviews ( example ) of .NET Standard 2.0 say that it now uses some kind of compatibility shim that fixes the third-party library compatibility issue. So you can use the third-party library with .NET Standard until it doesn't use any API which .NET Standard doesn’t have. What is not clear is how does this shim work? any drawbacks? and how to check that third-party library is supported? By directly adding it into the project and then trying to compile? This works by creating all the necessary libraries necessary that are referenced by classic .NET libraries. E.g. in .NET Core the

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

╄→尐↘猪︶ㄣ 提交于 2019-11-27 00:08:04
问题 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