How to create custom control in mvc 4 razor view which is pluggable to another mvc 4 razor view projects - asp.net-mvc-4

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.

Related

Expand view location to class library folder in ASP.NET Core 3.1

Consider, I have two projects as follows:
Test.Application (Class Library)
Test.Web (ASP.NET Core web application project)
In Test.Application project, there is a folder called EmailTemplates which contains all the email templates(.cshmtl files).
By default, ASP.NET Core Razor View Engine only search views in the Views folder of the Test.Web project. How can I configure that Razor View Engine will also search views in the EmailTemplates folder of the Test.Application class library project.
Thank you.

How to use existing Masterpage.Master in asp.net web project to another MVC4 _layout.cshtml project?

Please help me out that I have an existing project with Masterpage.master file and I want to use that design to new MVC4 project. so how can we incorporate this functionality. Please help.

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

IntelliSense for Razor Pages routes

I was toying with new Razor Pages in ASP .NET Core 2.0 and noticed some problems with IntelliSense.
When using tag helper for MVC controller I get usual help:
However there is no such help for asp-page tag helper used in Razor Pages:
Is this a problem with my Visual Studio or rather Razor Pages tags do not support it yet?
I use ASP .NET Core 2.0 with framework 4.7 on VS 2017 15.5.5.
It seems IntelliSense for routes is not supported (yet I hope), but there is an interesting workaround for that - see Razor Pages Url tt File. The idea is to create some SitePages.tt file in your ASP.NET Core 2 project using Razor Pages to scan the /Pages folder and output a class with string properties to get the IntelliSense for routes:
<cancel-button asp-page="#SitePages.DashboardIndex"></cancel-button>

Razor generator application throwing error as view not found in main MVC4 project

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.