RazorFormat Views in a Plugin

Previously, in a service we have had for a long time, we were adding the RazorFormat plugin and using it to render some HTML for some of the service operations.

We were defining the *.cshtml razor views in the Views folder of the VS web project. and supporting scripts/images/css in other folders in the project.

We had no problems rendering the razor views in HTML, and loading the other assets.

\Project
    \Views
        MyView.cshtml
    \Scripts
        MyJS.js
        jquery-1.9.1.js
    \Content
        MyCSS.css
    \Images
        MyImage.jpg

We loaded the views at runtime with code like this:

var razor = HostContext.GetPlugin<RazorFormat>();
            var view = razor.GetViewPage("MyView");

which renders HTML like this:

<html>
<head>
    <link href="~/Content/MyCSS.css" rel="stylesheet"/>
    <script src="~/Scripts/MyJS.js"></script>
    <script src="~/Scripts/jquery-1.9.1.min.js"></script>
</head>
<body>
...stuff
</body>
</html>

Now, we want to move the service, that uses Razor, into its own IPlugin into its own assembly, and we also need to move the files that contain the razor views, and supporting assets (scripts, images, etc) into that assembly.

How does one go about packaging these razor views/assets into the assembly that contains the plugin? (So that I get them out of the web project and into the assembly of the IPlugin perhaps as Embedded Resources or some other mechanism?)

Do I just need to change the VirtualFileSources of the RazorFormat to use the assembly resources?

appHost.Plugins.Add(new RazorFormat
            {
                VirtualFileSources = new ResourceVirtualFiles(GetType())
            });

and mark all the views *.cshtml and other assets (i.e. MyJS.js) as ‘EmbeddedResources’ in the plugin project? Will that just work?

Have a look at docs on Compiled Razor Views http://docs.servicestack.net/compiled-razor-views