.net-standard

WSHttpBinding in .NetStandard or .NET core

烈酒焚心 提交于 2019-12-01 05:54:21
I want to integrate NMVS protocol in my application which is providing wsdl files for testing which is written sample code in .net framework library. I want to test it in .netstandard, .netcore or UWP app but wsdl files only support to "WSHttpBinding" which is not supported in .netstandard, .net core and UWP. <wsdl:binding name="WSHttpBinding_ISinglePackServices" type="ns:ISinglePackServices"> WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; I used

How To Access Azure Function App ConnectionString Using dotnet Standard

我怕爱的太早我们不能终老 提交于 2019-12-01 05:50:45
My Azure Function App has a ConnectionString defined. I want to retrieve it from a C# function written in dotnet standard 2.0. I have tried adding System.Configuration.ConfigurationManager to the project.json and using var str = ConfigurationManager.ConnectionStrings["my string"].ConnectionString; but I get the error run.csx(24,15): error CS0103: The name 'ConfigurationManager' does not exist in the current context How do I access the connection string? Crazy Crab ConfigurationManager is not available in Azure Functions v2 .NET Standard projects. Azure FUnction v2 now uses ASPNET Core

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

喜你入骨 提交于 2019-12-01 04:19:21
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, try again if ((e.HResult & 0xFFFF) == 0x00000050) { continue; } // else rethrow it throw; } }

Error while reading json file in dotnet core “the configured user limit (128) on the number of inotify instances has been reached”

有些话、适合烂在心里 提交于 2019-11-30 20:08:59
I have an console application (in dot net core 1.1) which is scheduled in cron scheduler for every 1 min. Inside the application there is call to configuration file. I'm attaching the code below. public static T GetAppConfig<T>(string key, T defaultValue = default(T)) { T value = default(T); logger.Debug($"Reading App Config {key}"); try { var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); var builder = new ConfigurationBuilder() .AddJsonFile($"appsettings.json", true, true) .AddJsonFile($"appsettings.{environmentName}.json", true, true)

Advantages of netcoreapp2.0 vs netstandard2.0 for a library project

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 16:44:05
问题 I have a preexisting dotnet 4.6.2 solution that comprises of two outer projects (to be ported at the same time) and a shared core library. I need to choose the core assembly's TargetFramework , which could either be netcoreapp2.0 or netstandard2.0 . Since it won't be executable, or referenced by any external project, are there any advantages one way or the other? 回答1: They differ in nature: The .NET Standard is a set of APIs (standard) The .NET Core Libraries are a set of libraries

Failed to load Xamarin Forms project with .NET Standard 2.0 Lib in Rider

孤人 提交于 2019-11-30 13:57:24
TL;DR; Are Xamarin Forms projects with .NET Standard library 2.0 supported in Rider? I created a small Xamarin project in Visual Studio 2017.3 (Windows) using the blank forms app multiplatform wizard. Microsoft dropped the the option to create a PCL recently in the Windows version of VS and provides .NET Standard only. Thus I selected that one. Now I wanted to try out development on Mac directly using Rider so that I don't have to run a Windows VM (I really like Resharper so I am bound to Windows on my Mac) When I open this project in Rider on Mac OS, it throws a bunch of errors and it looks

.NET Standard - Merge a certificate and a private key into a .pfx file programmatically

ε祈祈猫儿з 提交于 2019-11-30 09:12:38
问题 Is there any way to combine a certificate and a key (both received separately as Base64 strings from a service) into a .pfx file using C#/.NET Standard programmatically ? Using a tool is not an option, since I need to automate it. The context: I need to load a certificate and a private key (separate Base64 strings without headers and footers) to a X509Certificate2 object to pass it on to the app from a .NET Standard 1.6 library. The problem is, there is no PrivateKey property in the

Microsoft.ServiceBus.Messaging vs Microsoft.Azure.ServiceBus

 ̄綄美尐妖づ 提交于 2019-11-30 08:38:38
MS has recently introduced the Microsoft.Azure.ServiceBus namespace. https://github.com/Azure/azure-service-bus/blob/master/samples/readme.md It is geared for the new .net standard framework (as if MS doesn't have enough semi-redundant code bases) My question is, how much better could it be in terms of performance? I can say with confidence, that the Microsoft.ServiceBus.Messaging leaves lots to be desired, in particular when it comes to persistent receiving. A very useful feature of the Microsoft.ServiceBus.Messaging , is the message pump, built on top of OnMessage() method. The new library,

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

可紊 提交于 2019-11-30 06:42:53
问题 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,

Convert .NET Core 2.0 class libraries to .NET Standard

与世无争的帅哥 提交于 2019-11-30 04:11:46
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 Core 2.0 to .NET Standard 1.6 or .NET Standard 2.0. In the project file, you can point target