What is obj/Debug/netcoreapp2.1/Razor folder? - asp.net

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.

Related

VS 2017 .Net Core project templates

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..).

Different installation for bootstrap.sass nuget package for ASP.Net Core and Full framework projects

When i create an empty ASP.NET Web Application (.NET Framework) project with VS 2017 and install the bootstrap.saas nuget package (https://www.nuget.org/packages/bootstrap.sass), the package integrates within the project structure and the Content and Scripts folders are being created.
As the folders are within the project folder, i can easily work with them like compile them and minify them and copy the results into my wwwroot folder.
But when i create an empty ASP.NET Web Application (.NET Core) project with VS 2017 and install the bootstrap.saas nuget package, the package lands in the global nuget cache in the C:\Users\USER_NAME.nuget\packages\bootstrap.sass\4.0.0-alpha6\content folder and not in the project folder.
What is the best workflow/practice here to work with the nuget cache files and get them compiled and minified to the wwwroot folder within the .NET Core project?
Can i force nuget with an additional NuGet.Config file inside my project to install the package within my project folder or subfolder? Are there other options?
I know that i can use npm/webpack/gulp etc. for that but would like to do it the "old" way how Web Extension Pack did it for VS 2015 and like the Web Compiler (both from Mads Kristensen) do it now for VS 2017. Or do i run into a dead end using the Web Compiler?
Thanks
Can i force nuget with an additional NuGet.Config file inside my project to install the package within my project folder or subfolder? Are there other options?
If you want to change packages default location for .net core project, you can set "NUGET_PACKAGES" environment variable. Just Set "NUGET_PACKAGES" = "c:\teampackages". Or you can place a NuGet.Config file next to the solution with the following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".\packages" />
</config>
</configuration>
For the detail info, you can refer to this document and the same issue on GitHub.
However, what I want to say is that you might not be happy with the results.
Because .Net Core projects rely on so many NuGet packages. Almost hovering around 1GB. I think you will not want to set all those packages for each solution. Besides, with this change, you need to set up additional sources in VS for every solution. It`s quite inconvenient for .net core project.
This is the reason why NuGet team set the special settings for .net core projects. So how about add the Content and Scripts folders manually? It would not be very difficult.
Hope this can help you.

What default dll's are imported into an asp.net webforms project

I've inherited a legacy code base that doesn't currently compile and has no project or solution file (there are multiple repositories including winforms and asp.net).
I'm not certain what .net version the original code was written in, nor what the project template was, although I know some are web forms.
I'm re-creating new solution and project files to import the code into, but need to find some of the default dll's included in old Visual Studio project templates (e.g. webforms).
Any ideas where I might find this information?
Anyone know an MSDN link with this on it?
P.S. I don't have access to the production code, although it is running in production.

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

Is Entity Framework 'Packages' folder needed for production?

I have a webforms projects with entity framework 5 and .NET 4.5. When I'm publishing the the web site it generates 'packages' directory in the compiled code, with some entity framework dll's in it. However the website functions well even If I remove it. It should be mentioned that I don't use code-first.
What is the purpose of this folder?
TIA.
First, make sure you're using EF5, as version 5.0, not the 4.4 that may happen if you first installed the EF5 on .net 4 and updated to .net 4.5 later.
http://thedatafarm.com/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/
From EF5 on, entity framework is a separate api(package) that can be installed via Library Package Manager or NuGet from Visual Studio, it is not part of .net framework installation any more.
packages folder is a default one for NuGet package installation.
So, please have a look at the EntityFramework reference that must be present in your project where you actually work with EF, and see the version and the location of assembly you are referencing. If your Copy Local property is set to true, you don't need to include packages folder in your installation package, assembly will be copied to bin folder automatically, otherwise you'll have to.
The short answer to your question is : No, you don't need the packages folder
Long answer : No, you don't need the packages folder in production, its created by nuget when you install a package to hold the dlls for that package.
So if you include EF in your project it will be copied in there and a reference will be added to your project to ~/packages/Entityframework.dll, at compile time a copy of the dll will be put in your bin folder.
During releases to our live environment I routinely remove this folder as its not needed.

Resources