VS 2017 .Net Core project templates - .net-core

I am following an article:
https://www.c-sharpcorner.com/article/angular-7-project-with-asp-net-core-apis-gym-project/
I am trying to create the 5 project solution (Note: the author does not explain how he created the solution/projects). 1 project is a .Net Core / ASP.NET Core Web Application. The other 4 are like 'class library' projects but when I try to create them I can't seem to find the correct project template for. These 4 projects have a properties and references folder (also 1 has an app.config file).
I tried the .Net Core/Class Library(.Net Core) template, however, it only creates a Class and Dependencies folder in the project.
What .net core template do I use?

You have the right template. It is a "Class Library (.NET Core)". The "Properties" can be added as a new folder (The icon is just used on a folder with that name). The app.config and Properties/AssemblyInfo.cs have types when add new item (see image). And the references section is only added when the project has dependencies (right click Dependencies -> Add References..).

Related

What is obj/Debug/netcoreapp2.1/Razor folder?

I have a .net core 2.1 project, all run ok...
After add a NuGet dependency, and ricomplied
on obj/Debug/netcoreapp2.1 folder is create a new folder named "Razor" with inside a View strucure with files like this... Default.g.cshtml.cs
Some of this many errors occour.
Is it possible to do not create this folder?
Razor used to be a separate project but was merged to .NET core. You can see the source code for it here. https://github.com/aspnet/Razor
Because Razor is a dependency as part of your .NET core project it will be included in your compiled code's output.

Upgrading .NET Framework 4.5 to 4.6.1 causes errors in Entity Framework classes

IDE :: VS.NET 2015
Version Upgrade :: 4.5 To 4.6.1
My asp.net solution contains more than 30 projects inside. I have upgraded the targeted framework to 4.6.1 and now i am getting these tons of error in EF classes. The existing EF version is 6.0.
Please suggest how to fix these errors cropped up from the EF classes. Should i upgrade the EF version also from the Nuget console also.
If you have any models created with the EF Designer, you will need to update the code generation templates to generate EF6 compatible code.
Delete existing code-generation templates. These files will typically be named .tt and .Context.tt and be nested under your edmx file in Solution Explorer. You can select the templates in Solution Explorer and press the Del key to delete them.
Note: In Web Site projects the templates will not be nested under your edmx file, but listed alongside it in Solution Explorer.
Note: In VB.NET projects you will need to enable 'Show All Files' to be able to see the nested template files.
Add the appropriate EF 6.x code generation template. Open your model in the EF Designer, right-click on the design surface and select Add Code Generation Item...
If you are using the DbContext API (recommended) then EF 6.x DbContext Generator will be available under the Data tab.
Note: If you are using Visual Studio 2012, you will need to install the EF 6 Tools to have this template. See Get Entity Framework for details.
If you are using the ObjectContext API then you will need to select the Online tab and search for EF 6.x EntityObject Generator.
If you applied any customizations to the code generation templates you will need to re-apply them to the updated templates.

Why does Visual Studio 2017 target netcoreapp when creating a new Class Library project

From this post on stackoverflow:
"If you are building a library (to be consumed by another library or application), you'll target netstandard1.X"
"If you are building an application (console, UWP, ASP.NET Core web app), you'll target netcoreapp1.0"
However when I create new .net core class library project in Visual Studio 2017 I see this:
<TargetFramework>netcoreapp1.0</TargetFramework>
Why does a class library target netcoreapp?
In the New Project wizard you should select .NET Standard from the left tree.
After creating project I get this:
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>
I have no idea why there is also a similar project in .NET Core section and its purpose but for most cases .NET Standard is right choice for Class Library projects.

Asp.NET 5 + Class Library (package) - how to include static content like CSS and JS file

I have a "Class Library (Package)" which creates a Nuget package with some CSS and JS content. The static files as inside the "content/" folder.
If I reference this Nuget package in a project created using the "ASP.NET 4.6.1 Template", all the files from Nuget "content/" folder are copied in to the empty project root. Which is fine.
If I reference this Nuget in a project created by "ASP.NET 5 Template", no files are copied. Is it some limitation of a new "ASP.NET 5 Templates" ?
I know I can use Bower for static files, but I do not want to end up with two packages, one for client side(Bower, css, js) and one for "Server" side (Nuger, DLL).

Purpose of the 'wrap' folder in ASP.NET 5 (Core 1.0) projects

I have ASP.NET 5 (or Core 1.0) project in solution and I tried to add reference in this project to some .NET Framework 4.5 projects. After adding reference in my solution folder a new folder 'wrap' is created.
This folder then makes some issues with references and packages versions. More in Referencing class library in ASP.NET 5 - dependency issues
What is this folder 'wrap' for?
The purpose is to enable library sharing between the 'old' csproj files and the new xproj. My take on why this is done as it is, is that this makes sure that, as the eco system moves forward and in a couple of years we've all happily forgotten about csproj dependencies, we have no remnants of supporting this in our own projects.
Looks like this wrap folder is no longer necessary. I
create an ASP.NET Core empty web project,
create a new csproj project, and
simply right click on .NET Core's Reference node. It no longer creates the wrap folder.
I remember the RC version of .NET Core used to create the wrap folder. This is no longer the case.
I am using VS2015 Update 3, ASP.NET and Web Tool 2015.1 14.1.211111.0, and Net Core SDK 1.0.0-preview2-003131

Resources