1

How can I make my views in my MVC3 Web project be compiled into my project assembly as defined in the project properties? E.g. I don't want them to be generated to a dynamic/random assembly.

The reason for this is that the views reference internal classes in a referenced library, therefore, the referenced library needs to include the MVC3 project's assembly in its assembly info.

starblue
  • 55,348
  • 14
  • 97
  • 151
Josh M.
  • 26,437
  • 24
  • 119
  • 200

2 Answers2

1

I haven't personally tried this but would adding:

<PropertyGroup>    
    <EnableUpdateable>false</EnableUpdateable>    
    <MvcBuildViews>true</MvcBuildViews>
</PropertyGroup> 

to the project file have the desired effect?

sclarson
  • 4,362
  • 3
  • 32
  • 44
  • Actually that didn't do it. But I do like the option to compile the views ate compile time, I'll leave that in there. The views still go to a random assembly. – Josh M. Jun 10 '11 at 03:27
1

I believe this is a bit more complicated than one would hope but is possible (at least for compiling into another dll outside of the main assembly)
See:

http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/

Including Views in a Class Library

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
  • Thanks, via that link I found the Razor Single File Generator VS extension from Microsoft which is what I'm trying to use now. It's not actually working (`Custom tool error: Could not load generator "MvcView"`) but I'll post another question about that. – Josh M. Jun 10 '11 at 15:32