What’s the difference between SDK and Runtime in .NET Core?

According to the .Net Core Guide, .NET Core is composed of the following items A .NET runtime, which provides a type system, assembly loading, a garbage collector, native interop and other basic services. A set of framework libraries, which provide primitive data types, app composition types and fundamental utilities. A set of SDK tools and … Read more

What are .NET Platform Extensions on docs.microsoft.com?

It represents APIs that are shipped as NuGet packages instead of being part of the shared framework for .NET Core. We don’t have the ability right now to identify the different packages and which target frameworks they support on learn.microsoft.com, but it’s something that is in our backlog to solve. So adding that as a … Read more

The default XML namespace of the project must be the MSBuild XML namespace

The projects you are trying to open are in the new .NET Core csproj format. This means you need to use Visual Studio 2017 which supports this new format. For a little bit of history, initially .NET Core used project.json instead of *.csproj. However, after some considerable internal deliberation at Microsoft, they decided to go … Read more

Auto Versioning in Visual Studio 2017 (.NET Core)

Add <Deterministic>False</Deterministic> inside a <PropertyGroup> section  of .csproj The workaround to make AssemblyVersion * working is described in “Confusing error message for wildcard in [AssemblyVersion] on .Net Core #22660” Wildcards are only allowed if the build is not deterministic, which is the default for .Net Core projects. Adding <Deterministic>False</Deterministic> to csproj fixes the issue. The reasons why .Net Core … Read more

How to log to a file without using third party logger in .Net Core?

Issue http://github.com/aspnet/Logging/issues/441 is closed and MS officially recommends to use 3rd party file loggers. You might want to avoid using heavyweight logging frameworks like serilog, nlog etc because they are just excessive in case if all you need is a simple logger that writes to a file and nothing more (without any additional dependencies). I … Read more

Unable to resolve ILogger from Microsoft.Extensions.Logging

ILogger is no longer registered by default but ILogger<T> is. If you still want to use ILogger you can register it manually with the following (in Startup.cs): public void ConfigureServices(IServiceCollection services) { var serviceProvider = services.BuildServiceProvider(); var logger = serviceProvider.GetService<ILogger<AnyClass>>(); services.AddSingleton(typeof(ILogger), logger); … } Where AnyClass can be something generic, such as: public class ApplicationLogs … Read more

How do I get .NET Core projects to copy NuGet references to the build output?

You can add this to a <PropertyGroup> inside your csproj file to enforce copying NuGet assemblies to the build output: <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> However, note that the build output (bin/Release/netcoreapp*/*) is not supposed to be portable and distributable, the output of dotnet publish is. But in your case, copying the assemblies to the build output is probably … Read more

How to auto create database on first run?

If you have created the migrations, you could execute them in the Startup.cs as follows. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope()) { var context = serviceScope.ServiceProvider.GetRequiredService<ApplicationDbContext>(); context.Database.Migrate(); } … This will create the database and the tables using your added migrations. If you’re not using Entity Framework … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)