104 questions
0
votes
0
answers
49
views
ASP.NET MVC project : views included into dll file in development
I change some setting and now my project is including the views into a dll file. I have looked over the web.config and debugging setting but I am not sure what happen but now I am seeing this roslyn ...
1
vote
0
answers
56
views
Razor rendering issue on Visual Studio 17.12
An interesting one myself and a couple of colleagues have come across on the same project;
Since updating to Visual Studio 17.12 (currently on 17.12.4) one or potentially more of my CSHTML razor files ...
0
votes
1
answer
78
views
How to debug Razor Asp.Net anchor tag generation when using Controller and Action
I am trying to learn Razor and Asp.Net, following a couple of courses. I see that this snippet of code should work, but the generated link is empty:
<a class="nav-link text-dark" asp-area=...
2
votes
0
answers
193
views
VS 2022, MVC, .net 6.0.8 "type or namespace name not found is _cshtml.g.cs in generated code
I keep getting
Error CS0246 The type or namespace name 'TuitionWaiverModel' could not be found (are you missing a using directive or an assembly reference?) LhuTuitionWaiver D:\OneDrive - ...
1
vote
2
answers
3k
views
Azure DevOps: “rzc generate exited with code 2”
I have an ASP.NET Core 3.x project that is built and deployed using Azure DevOps Pipelines. After upgrading the project to use C# 9.0—but not ASP.NET Core 5.0—my dotnet build (DotNetCoreCLI@2) task ...
4
votes
1
answer
690
views
Return View as String in .NET Core 3.0
I am working on generating HTML to send to a PDF generator and discovered this this question on Stackoverflow. It points to Paris Polyzos and his article. Upon implementing the code in .Net Core 3.0,...
1
vote
1
answer
424
views
CompilationFailedException when using IRazorViewEngine in non Sdk.Web projects to render Razor pages
I am trying to use IRazorViewEngine in a console application <Project Sdk="Microsoft.NET.Sdk"> (not <Project Sdk="Microsoft.NET.Sdk.Web">) to render a .cshtml page in memory. I registered ...
0
votes
0
answers
40
views
View in Controllers served when attempting to access View in Area
I have encountered an issue in ASP MVC whereby I am attempting to access a View in the admin Area App/Areas/Admin/Account/Manage, however the page sometimes serves the user profile page in the root ...
0
votes
0
answers
188
views
c# razor generator compile error with NancyFx project
First time ask question here hope sb can help me.
Background:
I am using Vs2017 creating a c# mvc program with NancyFX based on .NET 4.6 .
The program works find but I want to use razor generator to ...
1
vote
0
answers
462
views
How to execute partial views in RazorEngine
I have an MVC web API project that includes a folder views/forms, and i want to read the view as HTML string including the partial views;
this is my code to get the HTML string from the view
public ...
0
votes
0
answers
266
views
Layout in Razor generated views not working
I am have created two projects, where Main is the main project and WebApp as the second one. I am using RazorGenerator to call the Areas in my WebApp from Main.
I can access ~/Test/Default/Index of ...
0
votes
0
answers
127
views
Can I prevent Nuget from installing my package's dependency into a destination project?
I'm creating a nuget package for my open source project and I've run into an issue that I'd like someone to help me with.
My project is depending on a package called RazorGenerator.Mvc. This is a ...
0
votes
1
answer
47
views
How to Create a List<TSource> for Razor-generated .cshtml files
In relation to my previous question, I want to set the returned List<Class1> listClass in my .cshtml file. However, I cannot create the following code in the .cshtml file since it does not ...
2
votes
2
answers
693
views
Asp.Net MVC Helper: create a global helper for loading view with or without layout
I want to create a application in which if there is Ajax call it return Partial view and if it is a page refresh it return with layout and render script. But the problem is partial view won't render ...
-1
votes
1
answer
1k
views
Unable to modify cshtml page in mvc
There is a mvc application, in which I am trying to modify in pre-compiled CSHTML page(Index.cshtml)
@using System.Web.Mvc.Html
@model Services.Admin.ViewModels.IndexViewModel
@{
Layout = "~/Views/...
2
votes
0
answers
323
views
What is the best practice for creating a NuGet package from a project built using RazorGenerator?
I have an MVC-ish project that includes pre-compiled, reuseable views created by the RazorGenerator tool. This generates a reusable shell for other websites. I can successfully include that project in ...
0
votes
0
answers
51
views
Re-using views between ASP.NET MVC app
I have a customer facing ASP.NET MVC app and we are in the process of building a sister app. I want to be able to share some of the existing layouts, views from the main app. I looked at using ...
1
vote
0
answers
91
views
How to change generated assembly name to meaningful
Razorengine 3.9 is used to run many templates.
It creates assemblies with names like
CompiledRazorTemplates.Dynamic.RazorEngine_f06390a8eaeb403a8f8c121451f51dcf, Version=0.0.0.0, Culture=neutral, ...
2
votes
0
answers
572
views
How to get the HTML from a HelperResult
Update : I submitted this as an issue to RazorGenerator on github with a sample visual studio solution as attachment : https://github.com/RazorGenerator/RazorGenerator/issues/105
I am using ...
1
vote
1
answer
3k
views
Steps for using RazorGenerator.MsBuild
I have tried to follow the steps from Precompiling Razor views in ASP.NET MVC 3
I can see the view cs files in the "obj\CodeGen\" folder
I changed the line
<Import Project="$(SolutionDir)\...
1
vote
1
answer
2k
views
Code generated by RazorGenerator not executed, script code still is
So I installed RazorGenerator with nuGet and added the VS extension (thanks to Visual Studio cannot find custom tool RazorGenerator).
Just to try it out on my existing mvc app, I changed the custom ...
0
votes
0
answers
228
views
HtmlHelper Generate Validation Markup in Controller
This is somehow related to The Question
I am using jquery unobtrusive validation. I have the following model
public class MyModel
{
[Required]
public int ID { get; set; }
[MinLength(2)]
...
1
vote
1
answer
343
views
Html encoding with RazorGenerator.Templating
I am using RazorGenerator.Templating v2.3.11 for email templates. And Razor Generator plugin v1.9.1 - utilizing the TemplateTransformer.
https://www.nuget.org/packages/RazorGenerator.Templating
I ...
1
vote
0
answers
150
views
Html Helper HiddenFor Name broken, Id missing
I am using RazorGenerator to embed a view into a shared DLL. I have a HiddenFor that is generating an invalid name attribute and a missing id attribute.
I have a view model:
public class ...
1
vote
1
answer
682
views
RazorGenerator, getting started, can't get to run
I've created a new project and followed the steps in
http://www.carolynvanslyck.com/blog/2012/09/compile-time-support-for-mvc-views/
It worked, '.generated.cs' files popping out.
I then tried ...