.net-standard

Why .NET Standard 2 build references many assemblies instead of single netstandard.dll assembly

不打扰是莪最后的温柔 提交于 2021-02-17 05:16:30
问题 Unlike .NET Standard 1, .NET Standard 2 introduces a single netstandard.dll reference assembly. However, when compiling (with .NET Core SDK 2.2.203) with dotnet build we can see that it adds references to many assemblies (113), all under netstandard.library/2.0.3/build/netstandard2.0/ref/*.dll . One of these references is netstandard.dll . $ grep TargetFramework *.csproj <TargetFramework>netstandard2.0</TargetFramework> $ dotnet build --verbosity normal | grep -o netstandard.library/2.0.3

Why .NET Standard 2 build references many assemblies instead of single netstandard.dll assembly

大城市里の小女人 提交于 2021-02-17 05:15:13
问题 Unlike .NET Standard 1, .NET Standard 2 introduces a single netstandard.dll reference assembly. However, when compiling (with .NET Core SDK 2.2.203) with dotnet build we can see that it adds references to many assemblies (113), all under netstandard.library/2.0.3/build/netstandard2.0/ref/*.dll . One of these references is netstandard.dll . $ grep TargetFramework *.csproj <TargetFramework>netstandard2.0</TargetFramework> $ dotnet build --verbosity normal | grep -o netstandard.library/2.0.3

Can't access httpcontext extension methods in .net standard

好久不见. 提交于 2021-02-17 02:02:10
问题 I have this .NET Standard library where I want to write a .NET Core middleware. Inside which I want to do : Endpoint endpoint = httpContext.GetEndpoint(); The GetEndpoint() extension method can't be resolved. I have referenced Microsoft.AspNetCore.Http and I have both Microsoft.AspNetCore.Http.Abstractions and Microsoft.AspNetCore.Mvc.Core packages added to the project. Is there a solution to this, am I missing something? 回答1: I assume you're writing a middleware for ASP.NET Core 3.1 since

Can't access httpcontext extension methods in .net standard

你离开我真会死。 提交于 2021-02-17 02:01:49
问题 I have this .NET Standard library where I want to write a .NET Core middleware. Inside which I want to do : Endpoint endpoint = httpContext.GetEndpoint(); The GetEndpoint() extension method can't be resolved. I have referenced Microsoft.AspNetCore.Http and I have both Microsoft.AspNetCore.Http.Abstractions and Microsoft.AspNetCore.Mvc.Core packages added to the project. Is there a solution to this, am I missing something? 回答1: I assume you're writing a middleware for ASP.NET Core 3.1 since

.NETStandard multi-targeting library packages do not get restored when building

こ雲淡風輕ζ 提交于 2021-02-10 05:44:15
问题 Background: I have created a multi-targeting library that targets net40 , net462 , and netstandard2.0 . The purpose of this library is to wrap StackExchange.Redis and some related reconnect logic. For net40 I need to use an older version of the package than the newer targets. Here is my csproj file: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net40;net462;netstandard2.0</TargetFrameworks> </PropertyGroup> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">

Loading an external .NET Standard 2.0 assembly with blazor

左心房为你撑大大i 提交于 2021-02-06 11:29:15
问题 In a Blazor app, I want to load an external assembly and execute a method. For this, I have created a new ASP.Net Core webapplication using the Blazor template. Then, in a Razor Page (which will be compiled and executed by browser/wasm) I use reflection to load the assembly and run the method (based on code found here) // download external assembly from server HttpClient client = new HttpClient(); var bytes = await client.GetByteArrayAsync("http://localhost:62633/_framework/MyCustomLib.dll");

Loading an external .NET Standard 2.0 assembly with blazor

依然范特西╮ 提交于 2021-02-06 11:22:07
问题 In a Blazor app, I want to load an external assembly and execute a method. For this, I have created a new ASP.Net Core webapplication using the Blazor template. Then, in a Razor Page (which will be compiled and executed by browser/wasm) I use reflection to load the assembly and run the method (based on code found here) // download external assembly from server HttpClient client = new HttpClient(); var bytes = await client.GetByteArrayAsync("http://localhost:62633/_framework/MyCustomLib.dll");

Loading an external .NET Standard 2.0 assembly with blazor

荒凉一梦 提交于 2021-02-06 11:21:05
问题 In a Blazor app, I want to load an external assembly and execute a method. For this, I have created a new ASP.Net Core webapplication using the Blazor template. Then, in a Razor Page (which will be compiled and executed by browser/wasm) I use reflection to load the assembly and run the method (based on code found here) // download external assembly from server HttpClient client = new HttpClient(); var bytes = await client.GetByteArrayAsync("http://localhost:62633/_framework/MyCustomLib.dll");

Can the Encoding API decode a Stream/noncontinuous bytes?

China☆狼群 提交于 2021-02-05 11:12:26
问题 Usually we can get a string from a byte[] using something like var result = Encoding.UTF8.GetString(bytes); However, I am having this problem: my input is an IEnumerable<byte[]> bytes (implementation can be any structure of my choice). It is not guaranteed a character is within a byte[] (for example, a 2-byte UTF8 char can have its 1st byte in bytes[1][length - 1] and its 2nd byte in bytes[2][0]). Is there anyway to decode them without merging/copying all the array together? UTF8 is main

Can the Encoding API decode a Stream/noncontinuous bytes?

送分小仙女□ 提交于 2021-02-05 11:10:21
问题 Usually we can get a string from a byte[] using something like var result = Encoding.UTF8.GetString(bytes); However, I am having this problem: my input is an IEnumerable<byte[]> bytes (implementation can be any structure of my choice). It is not guaranteed a character is within a byte[] (for example, a 2-byte UTF8 char can have its 1st byte in bytes[1][length - 1] and its 2nd byte in bytes[2][0]). Is there anyway to decode them without merging/copying all the array together? UTF8 is main