views:

1698

answers:

7

I'm using a Web Deployment Project in Visual Studio 2008 in order to prepare my ASP.NET application (ASP.NET web application, not ASP.NET web site) for being copied to several servers. I have to copy the files on local staging servers, on different servers via FTP and sometimes I have to fetch them from customers' servers.

So, it would be nice to have all files for deployment in a compact form without the necessity of doing a lot of comparing between source and destination. Web deployment projects have this nice feature: compile all your aspx and ascx files into a single (additional) assembly.

I somehow found out how to get rid of aspx placeholder files on the server, now I'd like to know if there is a (maybe self-made) way to get rid of these .compiled files.

From Rick Strahl's blog:

The .Compiled file is a marker file for each page and control in the Web site and identifies the class used inside of the assembly. These files are not optional as they map the ASPX pages to the appropriate precompiled classes in the precompiled assemblies. If you remove the .Compiled file, the page that it maps will not be able to execute and you get a nasty execution error.

Anybody out there with a creative idea, maybe using a module/handler which intercepts the check against the .compiled files in the bin folder?

Thank you!

A: 

I don't know about the .compiled files, but you could set up your servers to update their files with subversion instead of manually copying the files when you compile.

So you would compile the files using the Web deployment project (not into a single assembly), put them in a repository you created for this purpose, and on each server, just do an svn update to fetch and compare the files automatically.

I know it's not what you asked for directly, but it may be a path to explore.

GoodEnough
Thank you for your answer. I thought about it myself, but I hadn't time to test it yet.
splattne
This doesn't really work since WDP erases the whole directory every build screwing up SVN
John Sheehan
That's why I mentioned putting the files in another repository.
GoodEnough
+2  A: 

The .compile file comes from pre-compiling on deployment. So you basically have 3 options:

  1. Keep the .compiled file
  2. Don't pre-compile and deploy source code
  3. Turn this in to a Web Application instead of a Web Site and compile as an assembly

I have run in to the same problem myself. I actually choose #1 in most cases when dealing with deployment of Web Sites, but on the rare occasion when I know I am going to have to maintain the site for an extended period of time, I take the time to upgrade it to a Web Application.

Nick Berardi
This is already a Web Application.
splattne
A: 

Add "Exclude Filter" to your deployment project:

  1. In the Deployment Project.
  2. Right Click on Content Files.
  3. Click on "Exclude Filter".
  4. Add "*.Compiled"
  5. click OK.

and thats it.

Khaled Musaied
The problem is, that this way the app doesn't work anymore. You need them if you have no other mechanism...
splattne
When you deploy an asp.net web project you only need .aspx,.ascx,.asmx,and configuration files. any thing other than that is useless.
Khaled Musaied
@Khaled - If you have a precompiled web project, your as?x pages also compiled up, and are replaced with a .compiled placeholder.
Zhaph - Ben Duguid
A: 

I remember at the days when I cant do Web Application with VWD Express, I use nant script to compile the project into a single dll and deploy, that would work (so I dont need the full VS to do dll deployment too), so if you really don't want to mess your project to Web Application, maybe this is a path to check too.

goodwill
+2  A: 

I don't like the .compiled files either, but nobody gets hurt if they're there. So why bother?

devio
It's just... they seem so unnecessary, if there is only one assembly. And synching over FTP is a PITA...
splattne
+1  A: 

You might want to take a look at Virtual Path Providers (KB how to here) in ASP.NET.

Credit for this suggestion must go to Cheeso and his self answered question here:

Can I get “WAR file” type deployment with ASP.NET?

Zhaph - Ben Duguid
A: 

You can get rid of the .compiled files by using the aspnet_merge tool with the -r option.

Removes the .compiled files for the main code assembly (code in the App_Code folder). Do not use this option if your application contains an explicit type reference to the main code assembly.

Bob
Unfortunately I have no code in the App_Code folder, it's a web application project.
splattne