.net-core

How to dockerize dotnet core angular template application?

落花浮王杯 提交于 2021-02-19 04:01:27
问题 I created a web application using the dotnet cli angular template. dotnet new anguar Web Now I want to dockerize this application. I added the following Dockerfile to the project folder. FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env WORKDIR /app # Copy csproj and restore as distinct layers COPY *.csproj ./ RUN dotnet restore # Copy everything else and build COPY . ./ RUN dotnet publish -c Release -o out # Build runtime image FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 WORKDIR /app

AsyncLocal values not correct with TPL Dataflow

こ雲淡風輕ζ 提交于 2021-02-19 02:59:06
问题 Consider this example: class Program { private static readonly ITargetBlock<string> Mesh = CreateMesh(); private static readonly AsyncLocal<string> AsyncLocalContext = new AsyncLocal<string>(); static async Task Main(string[] args) { var tasks = Enumerable.Range(1, 4) .Select(ProcessMessage); await Task.WhenAll(tasks); Mesh.Complete(); await Mesh.Completion; Console.WriteLine(); Console.WriteLine("Done"); } private static async Task ProcessMessage(int number) { var param = number.ToString();

How to add private nuget source in dotnet dockerfile?

大城市里の小女人 提交于 2021-02-19 01:59:50
问题 I try to add (override) a private nuget source to my build script in order to add the user/pw - and keep it out of my source control. What I tried so far: nuget is not recognized as command inside the image dotnet nuget does not have the command to add additional sources installing nuget does not effect dotnet restore FROM mcr.microsoft.com/dotnet/core/sdk:2.2 RUN apt-get update && apt-get install -y nuget RUN nuget source Add -Name "Private Feed" -Source ".." -UserName "UserVAR" -Password

CngKey.Import on azure

陌路散爱 提交于 2021-02-18 21:07:18
问题 var rawData = Convert.FromBase64String(_signingKey); var cng = CngKey.Import(rawData, CngKeyBlobFormat.Pkcs8PrivateBlob); I use this code to extract key, from embedded base64 string. It works fine when I test it locally but when I publish on azure I get following exception: WindowsCryptographicException: The system cannot find the file specified (once again I'm not reading from any file) I need this to communicate with apple apns for push notifications, is there any workaround? And this

CngKey.Import on azure

强颜欢笑 提交于 2021-02-18 21:02:03
问题 var rawData = Convert.FromBase64String(_signingKey); var cng = CngKey.Import(rawData, CngKeyBlobFormat.Pkcs8PrivateBlob); I use this code to extract key, from embedded base64 string. It works fine when I test it locally but when I publish on azure I get following exception: WindowsCryptographicException: The system cannot find the file specified (once again I'm not reading from any file) I need this to communicate with apple apns for push notifications, is there any workaround? And this

Microsoft.ReportViewer.WinForms.V15 not compatible with .NET Core 3.1 - How to show RDLC in WPF Core?

安稳与你 提交于 2021-02-18 18:57:49
问题 I have wpf core 3.1 project and installed Microsoft RDLC Report Designer extention on VS 2019 and created a rdlc file. Now I want to show that rdlc in a window but there is not ReportViewer control. I installed Microsoft.ReportViewer.WinForms v15 package from nuget but it shows error : "Package 'Microsoft.ReportViewer.WinForms' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2,

System.Text.Json Merge two objects

左心房为你撑大大i 提交于 2021-02-18 12:11:29
问题 Is it possible to merge two json objects like this with System.Text.Json? Object 1 { id: 1 william: "shakespeare" } Object 2 { william: "dafoe" foo: "bar" } Result Object { id: 1 william: "dafoe" foo: "bar" } I am able to achieve it with newtonsoft.json like this var obj1 = JObject.Parse(obj1String); var obj2 = JObject.Parse(obj2String); obj1.Merge(obj2); result = settings.ToString(); But is there a way with System.Text.Json ? 回答1: As of .Net Core 3.0 merging of JSON objects is not

System.Text.Json Merge two objects

最后都变了- 提交于 2021-02-18 12:10:32
问题 Is it possible to merge two json objects like this with System.Text.Json? Object 1 { id: 1 william: "shakespeare" } Object 2 { william: "dafoe" foo: "bar" } Result Object { id: 1 william: "dafoe" foo: "bar" } I am able to achieve it with newtonsoft.json like this var obj1 = JObject.Parse(obj1String); var obj2 = JObject.Parse(obj2String); obj1.Merge(obj2); result = settings.ToString(); But is there a way with System.Text.Json ? 回答1: As of .Net Core 3.0 merging of JSON objects is not

“Did you mean to run dotnet SDK commands? Please install dotnetsdk” in windows command prompt

笑着哭i 提交于 2021-02-18 11:59:23
问题 I have just installed dot net core sdk and runtime (2.2.1) on my system viz. a Windows Server 2012R2. I am trying to create a console app using the command prompt using dotnet new console but it says Did you mean to run dotnet SDK commands? Please install dotnetsdk Is there any other configurations needed. The Environment path variable also contains the following folder C:\Program Files\dotnet. I have not installed VS2017. Was trying to use VS Code 回答1: Please, make sure you've installed SDK

Does .NET Core 2.0 have SFTP client? [closed]

本小妞迷上赌 提交于 2021-02-18 10:14:45
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Needing to use an SFTP client and looking to build it in a .NET Core 2.0 application. I was wondering if SFTP is already part of .NET standard 2.0 or will I need to use a 3rd party library for this, e.g. SSH.NET? 回答1: There's no SFTP client in any current version