0

Does there exist a method when publishing an ASP.NET MVC application to completely remove the .aspx view files (and if possible .master too) by compiling them into the application DLL as resources?

The published application would just be the /bin folder, Global.asax and web.config, a default.aspx if needed, and whatever is in the /Content folder. All the views would be contained in the MyProject.dll file.

To clarify I don't mean where every .aspx is overwritten with a 1 line dummy file referencing the correct resource, but where those files can be eliminated entirely in the published app.

The goal here is to simply change management and all the auditing and layers of people surrounding it - one file gets deployed, that file replaces the existing file, and no messing around with a stack of .aspx files that have to be added/removed/updated (yes, SVN or a similar solution handle that problem instead, but management politics prevent this).

Rich Seller
  • 83,208
  • 23
  • 172
  • 177
David
  • 24,700
  • 8
  • 63
  • 83
  • Dupe: http://stackoverflow.com/questions/222276/how-do-i-compile-an-asp-net-website-into-a-single-dll –  Feb 26 '09 at 14:15
  • I specifically said MVC (which is already a web application and compiles the main code into a dll), and specifically said that I was looking for a solution that did not leave behind dummy aspx files - I was already aware of aspnet_merge and compiling web form code behind files. – David Feb 26 '09 at 17:16

2 Answers2

1

Is this what you are looking for?

Community
  • 1
  • 1
JSC
  • 3,705
  • 3
  • 26
  • 25
  • This looks like it is on the right track, I had expected I'd need to overide behavoir somewhere to make it happen. It will be a few hours before I can try fleshing this out to a full solution. – David Feb 27 '09 at 12:08
0

It's possible with the web forms view engine but you'll have to extend the path provider yourself.

Here is a question here at SO about the same thing: Using VirtualPathProvider to load ASP.NET MVC views from DLLs

If you use the Spark view engine, it already has additional path providers built in.

The documentation can be found here: Adding a view folder to config

It allows you to locate your views inside a DLL as an embedded resource, somewhere else on the file system, using the default virtual directories, or plug in your own custom provider.

Community
  • 1
  • 1
Jay
  • 381
  • 1
  • 10