Conditionally embed ASP.NET MVC2 Views as resources during build in Visual Studio 2010

Posted by jslatts on Stack Overflow See other posts from Stack Overflow or by jslatts
Published on 2010-04-22T14:39:30Z Indexed on 2010/04/22 15:03 UTC
Read the original article Hit count: 239

I have a ASP.NET MVC2 project in VS2010 that can be deployed in two modes: standalone or plugin. In standalone mode, the views should live outside the compiled assembly as .aspx files (the default setup). In plugin mode, the views are switched (currently by hand) to embedded resources and the entire assembly is dropped into a host project folder.

Currently, this requires the developer to go through each view and switch it from Build Action: "Content" to "Embedded Resource" and vice versa. I would like to create a new solution configuration to automatically grab all .aspx files and build them as resources.

This SO post seems like the solution, but I would prefer not to have to edit the .csproj every single time I add a new view to the project. Is there a way to use a wild cards or some other batch/global conditionally statement to change resources from content to embedded?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about msbuild