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.

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.