.net-core-3.0

Deploying .NET Core 3.0 API to Azure Web App using Release Pipeline

痞子三分冷 提交于 2020-01-14 14:15:11
问题 I'm attempting to upgrade my API from .NET Core 2.2 to 3.0, but I cannot get the Azure Web App to actually run the application using 3.0. My build pipeline configuration: trigger: - master pool: vmImage: 'ubuntu-latest' variables: buildConfiguration: 'Release' steps: - task: UseDotNet@2 displayName: 'Use .NET Core 3' inputs: version: 3.x - script: dotnet tool install --global dotnet-ef - script: dotnet build --configuration $(buildConfiguration) displayName: 'dotnet build $(buildConfiguration

Will ClickOnce be ported to .NET Core 3 as well as WinForms?

别来无恙 提交于 2020-01-14 08:03:35
问题 Now that Winforms is being ported to .NET Core 3, what technology will be used for deploying those apps? Will ClickOnce also be ported? Many of the properties used by ClickOnce are currently stored in the .csproj file, but those project files change significantly between .NET Framework and .NET Core, so presumably this would require changes to Microsoft's ClickOnce code to make it work? Has there been any official word from Microsoft on this, I can't find anything in the documentation? 回答1:

.Net Core 3.0 TimeSpan deserialization error

孤人 提交于 2020-01-13 19:43:33
问题 I am using .Net Core 3.0 and have the following string which I need to deserialize with Newtonsoft.Json: { "userId": null, "accessToken": null, "refreshToken": null, "sessionId": null, "cookieExpireTimeSpan": { "ticks": 0, "days": 0, "hours": 0, "milliseconds": 0, "minutes": 0, "seconds": 0, "totalDays": 0, "totalHours": 0, "totalMilliseconds": 0, "totalMinutes": 0, "totalSeconds": 0 }, "claims": null, "success": false, "errors": [ { "code": "Forbidden", "description": "Invalid username

JsonSerializer behaves not as expected when the specifc class is casted to something else

a 夏天 提交于 2020-01-13 16:30:08
问题 Im trying to migrate from json.net to microsoft's json and found something that behaves very differently. Let's use this simplified example: public interface IName { string Name { get; set; } } public class Person : IName { public string Name { get; set; } public int Age { get; set; } } public void Foo() { IName p = new Person {Age = 4, Name = "Waldo"}; var s1 = System.Text.Json.JsonSerializer.Serialize(p); // --> {"Name":"Waldo"} var s2 = Newtonsoft.Json.JsonConvert.SerializeObject(p); // --

Should a library explicitly target .NET Core 3?

大憨熊 提交于 2020-01-13 05:00:28
问题 With the release of .NET Standard 2.0, it's advised to target .NET Standard 2.0, even if you target 1.x already. https://docs.microsoft.com/en-us/dotnet/standard/net-standard: However, targeting lower .NET Standard versions introduces a number of support dependencies. If your project targets .NET Standard 1.x, we recommend that you also target .NET Standard 2.0. This simplifies the dependency graph for users of your library that run on .NET Standard 2.0 compatible frameworks, and it reduces

How to use enums with EnumMember attribute in FromBody ViewModel in Web API Request?

孤街醉人 提交于 2020-01-11 13:35:09
问题 I'm trying to implement an HttpPost method in an ASP.NET Core Web API project with a [FromBody] view model and enums. In the past, binding view models with the [FromBody] attribute worked well. In my particular scenario, I want to offer a JSON endpoint where I convert a given value into a C# enum with different names. This example should explain what I want to achieve: public enum WeatherEnum { [EnumMember(Value = "good")] Good, [EnumMember(Value = "bad")] Bad } Internally, I want to use

How to use stored procedures with SqlParameters in EF Core 3.0

ⅰ亾dé卋堺 提交于 2020-01-11 09:49:30
问题 I have tried the below var p = new SqlParameter("Option", "AUTHENTICATE"); var user = _context.Set<User>().FromSqlRaw("EXECUTE dbo.spGeneral_Authenticate @Option", p).ToList(); var user = _context.Set<User>().FromSqlRaw("EXECUTE dbo.spGeneral_Authenticate @Option=@Option", p).ToList(); and SqlParameter[] ps = new SqlParameter[1]; ps[0] = new SqlParameter("Option", "AUTHENTICATE"); var user = _context.Set<User>().FromSqlRaw("EXECUTE dbo.spGeneral_Authenticate @Option", ps).ToList(); var user =

Azure functions stopped working after Core 3.0 update

≡放荡痞女 提交于 2020-01-11 07:30:08
问题 The code is working in Core 3.0 preview7 version, but after updating to 3.0 Azure functions started giving an error. The error comes if I try to access builder service object. Also not able to debug the issue. Also tried updating Microsoft.Extensions.DependencyInjection 3.0 but still the same error. public class Startup : FunctionsStartup { public override void Configure(IFunctionsHostBuilder builder) { var descriptor = builder.Services.FirstOrDefault(d => d.ServiceType == typeof

Trying to apply an authorisation filter in all my controllers bug IAuthorizationHandler is not being used

喜夏-厌秋 提交于 2020-01-06 08:06:08
问题 I try to define an authorization policy to be applied in all methods of all my controllers. I am trying to follow the guidelines given here, in "Authorization for specific endpoints" subsection to substitute my previous AuthorizeFilter but it does not work. In my Startup I have: app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute().RequireAuthorization(); }); In ConfigureServices : services.AddAuthentication(AzureADDefaults

missing “System” reference on ubuntu and .net core 3.0

假如想象 提交于 2020-01-05 08:34:27
问题 I'm trying to develop a simple web app using .Net Core 3.0 on an Ubuntu machine. I setup the .Net Core SDK and the runtime from this link. I setup VS Code and then I create a project using the following commands dotnet new webapp -o RazorPagesMovie code -r RazorPagesMovie I built the project and it is working. But in VS Code, it shows the following error: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) screenshot of vs code