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...
Related
I have used before AngularJS with webforms in some projects at work. I'm starting to migrate everything to .Net Core Razor mixing MVC as well and I would like to use latest Angular for some client side to work with web Apis mostly.
I see there is new .Net Core Angular Template and that you can Angular Items to your Solution in razor template, but how can I actually just add latest angular version to my existing razor project?
Use npm. See how to configure dependencies in package.json. In visual studio right click on solution -> Add -> New Item...
For latest angular add #angular/core package.
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.
I'm new to the razor generator. I used razor generator in my mvc4 project and i'm sharing views using this app to my other mvc4 projects.
I added reference of common project to my main project and I'm accessing views but it is throwing error as view not found.
Then I added razor generator in my main project too and then it is working exactly as I want.
Now my issue is that if I'm adding razor generator in my common application then why I need to again add razor generator in my other MVC4 application ?
Bit late for the OP maybe....
Make sure the views are in "Views\Shared".
That was the only way I was able to get my main MVC project to find Razor Generator generated views in my library MVC project.
I want to create a custom control in mvc4 razor view engine which is to be created as a dll
and that dll will be pluggable to another mvc 4 razor projects.
Thanks in advance.
There's a post here on using the Razor File Generator, which addresses the same issue as you have http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx
The project is in codeplex, so you can get the Source Code and the Documentation any any other information from here.
breeze is a great library. Because of project complexity I don't want to use spa template. Is there a way I can use breeze in a regular .net mvc4 project?
We're releasing support for it very soon - directly in ASP.NET MVC and Visual Studio. Stay tuned...!
Absolutely, just start with an empty .net MVC4 project and run the 'base' breeze nuget package ( the one that doesn't say 'sample').