Razor generator application throwing error as view not found in main MVC4 project - asp.net-mvc-4

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.

Related

How can I use SmartAssembly to obfuscate an ASP.NET Core app with Razor Pages?

I'm trying to obfuscate my Razor app with SmartAssembly, but I've ran into a problem.
I have lots of Razor (cshtml) pages in my app that all contain references to many different types across the project. This is a problem, because the cshtml files are not compiled during deployment, and the obfuscation process doesn't affect them. This leads to a ton of TypeLoadExceptions and MissingFieldExceptions, because as the cshtml files are being compiled during runtime, the C# code in them references the original, non-obfuscated types.
I've tried enabling PrecompileBeforePublish hoping that it would separate the C# from the HTML so it can be processed by SmartAssembly, but the pages don't seem to be compiled in the build.
Is there a setting somewhere in SmartAssembly that enables Razor support, or can I do something with my ASP.NET Core project to make obfuscation possible?
ASP.NET Core Version: 3.1
SmartAssembly Version: 7.5

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

asp.net core project occurs MissingMethodException

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.

How to create custom control in mvc 4 razor view which is pluggable to another mvc 4 razor view projects

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.

MVC 4 - Getting error while trying to add a new report

Followed the steps within this link, I succeeded to run a report using a DXperience ASP.Net MVC Web application project wizard, but when I tried to reproduce exactly the same thing using a basic ASP.Net MVC Web application project wizard, I got no debugger error while compiling, but the browser returned the the following error:
It doesn't look like the DevExpress extensions are visible in the namespace of your view. Add a using, or add it to your Web.Config under ~/Views
#using Devexpress; // or whatever the namespace is
Also, you need to make sure that Devexpress is added as a reference to the project, if it's not already added.