0

My understanding is that several assemblies are produced by the compiler for ASP.NET MVC application:

  1. All code in App_Code is compiled into its own dll.
  2. Individual view.cshtml files located inside Views folder are compiled each into their own separate assembly.

In that regard a few questions:

  1. Is there a way to produce just one assembly (preferably by merging 1 and 2 above, or at least by compiling all cshtml views into one assembly)?

  2. Is there a way to control assembly name, version?

  3. Are there any web.config settings that specifically control this on-demand compilation of cshtml files and files in the App_Code folder?

The reason I need more control is because I would like to use the InternalsVisibleTo attribute on my shred class library, so that I can use its functionality from my cshtml files (I cannot set accessibility level to public for my own reasons, so they have to remain internal, and I do not want to deal with conditional compilation either).

Fit Dev
  • 3,413
  • 3
  • 30
  • 54
  • **Cshtml** files are open source.You can hide your code in **Actionresult** and transfer to view the result by **viewbag** – M.R.T Feb 01 '17 at 19:36

1 Answers1

0

You could change your routing, create a custom class to inherit from the RazorViewEngine class and add the assembly attribute. Assembly Attribute. More on how to create your custom class here

Community
  • 1
  • 1
Alf Moh
  • 7,159
  • 5
  • 41
  • 50