splattne
splattne

Reputation: 104030

ASP.NET Web Deployment Projects: getting rid of .compiled files

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?

Upvotes: 14

Views: 7292

Answers (8)

Burak SARICA
Burak SARICA

Reputation: 721

If you publish your code as updateable (in publish settings) these files are generated. Uncheck that value and republish. This is an old question I know, but no answers are clearly defined for this here.

Upvotes: 0

Bob
Bob

Reputation: 99684

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.

Upvotes: 0

Zhaph - Ben Duguid
Zhaph - Ben Duguid

Reputation: 26956

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?

Upvotes: 1

devio
devio

Reputation: 37205

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

Upvotes: 2

William Yeung
William Yeung

Reputation: 10556

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.

Upvotes: 0

Khaled Musaied
Khaled Musaied

Reputation: 2493

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.

Upvotes: 0

Nick Berardi
Nick Berardi

Reputation: 54854

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.

Upvotes: 4

mbillard
mbillard

Reputation: 38832

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.

Upvotes: 0

Related Questions