asp.net core project occurs MissingMethodException - asp.net-core

I create a new project with ASP.NET Core Web Application(.NET Core).
And it can work after building and running it.
I create a class library with .NET Core and move the files under Service folder in the web project to the library, then add the reference and change namespace in the controllers.
It occurs MissingMethodException after registering a new user.
Asp.net core project seems not able to use class library outside the web project.
The detailed message is as the below.

In ASP.NET Core , everything is in form of nuget packages, hence you might have to create nuget package from the class library and then add it to the current solution.
Hope this information helps.

Related

asp.net core 3.1 accountcontroller missing when creating new project

when I create a new project asp.net core 3.1 with Visual Studio with Individual User Accounts selected.
I can't find the Account Controller folder. There is an Areas folder but almost empty
Identity is working but where are the codes?
You are looking for scaffold identity
To add Identity scaffolding to a project, read:
https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-3.1&tabs=netcore-cli#scaffold-identity-into-an-empty-project
However for .Net 3.1, you’ll need to add these via NuGet and select the 3.x.x versions, else dotnet will try to install the latest .Net 6 which is incompatible with .Net3.1…
Also, having done all that, you get the Area/Identity/Pages/Account folder with more .cshtml files. But still don't see the AccountController in the Controllers folder.
It turns out the code for each operation is in the .cs files for each of the views in the Account folder, per Razor page paradigm.

Unable to reference a Blazor Component Library project

I am trying to follow this article to create a razor component library.
This in itself is not an issue.
The issue comes when i try to reference this project to my Blazor project.
When i create my Blazor project, it is always created as a .Net Standard project. The Razor component library is created as an Asp.net Core project.
I am unable to create the Blazor project as Asp.net Core.
And im unable to create the component library as .Net standard.
What am i doing wrong here?
Let's begin here:
I am unable to create the Blazor project as Asp.net Core
Selecting server-side Blazor results in a project in Asp.net Core
With server-side Blazor you can create a Razor Class Library.
With client-side Blazor you cannot create a Razor Class Library. You can instead create a Blazor component library.
The Blazor component library should be created by the blazorlib template in a command shell... Do this:
dotnet new blazorlib -o MyComponentLib1
Now add the newly created Blazor component library project to your solution, and use it according to the instructions described here:https://learn.microsoft.com/en-us/aspnet/core/blazor/class-libraries?view=aspnetcore-3.0&tabs=visual-studio#consume-a-library-component
Hope this helps...

Version conflict occur in Microsoft.Entity.FrameworkCore

I am working on a .net core web application with razor pages.
My application structure is like :
DemoCoreApplication with class Libraries "BLL.Data" and "BLL".
In BLL.Data, I have made the DB context then I have added the reference of "BLL. Data" project into my main project i.e: DemoCoreApplication.
Refrences in BLL.Data class library:
After building the main project (DemoCoreApplication), I got some strange version conflicting errors.
I believe the following steps will solve your problem
Install .Net Core 2.2 SDK (if you don't have)
Convert all projects in the solution to use .Net Core 2.2
Rebuild, Start the project

ASP.NET Core 1.1 Identity dependencies and all Data Access in a separate class library project

I have extracted most of the Database related code from an ASP.NET Core Web Application project with Individual User Accounts, ie. Identity into an ASP.NET Class Library project. I am now stuck in the final pieces which is to remove the concrete assignment to EF Core and moving the connection strings to the Data project.
Here is what I have done so far:
Created a blank solution
Created an ASP.NET Core web
application (TestPatterns.Web) with Individual User Accounts
Updated all the Nuget packages
Created a Class Library Core
package
In the Class Library Project (TestPatterns.Data) Nuget ->
Removed the NetStandard Library 1.6, replaced with
Microsoft.NetCore.App 1.1.0
In the Class Library Project (TestPatterns.Data), added all the EF and
Identity Nuget Packages
Moved over of the 'Data' folder from the
Web application to the class library project
Moved over the
ApplicationUser.cs file from the Web Application to the class
library project folder Models
I end up with a structure like this:
To run a migration I execute the following on the Data project folder:
dotnet ef --startup-project ../TestPatterns2.Web migrations add first
Looking for some help on removing all dependencies of EF Core 1.1 from the Web project and moving the connection strings over. Also, would the DI remain in the Web project or should that move to the Data project also? If so, how?

app.config in asp.net core 1.0 rc2 class library

Is it possible to read custom sections defined in the app.config in a .net core 1.0 class library project? In the asp.net core web project the custom sections are read correctly from the config however they are not accessible when called from a class library project. Prior to the upgrade and in a rc1 class library proj the app.config sections were being read however that is not the case after the upgrade.
Is there a setting in the project.json that I am missing or do I need to create a custom configuration provider?
Thanks for any insight.