14

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?

Community
  • 1
  • 1
splattne
  • 100,048
  • 51
  • 202
  • 247
  • 1
    I use Web Application instead of Web Site just like you but i have never seen .compiled before – Barbaros Alp Feb 03 '09 at 10:13
  • I' _using_ Web Applications. But in order to deploy the aspx/ascx _precomplied_, I use Deployment Projects. Here: http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=0aa30ae8-c73b-4bdd-bb1b-fe697256c459&displaylang=en – splattne Feb 03 '09 at 11:41
  • I have asked the same question before http://stackoverflow.com/questions/59191/do-i-need-to-copy-the-compiled-files-to-the-production-server and ended deploying then source code (I own the server) because it's more easy to compare the changes needed to deploy – Eduardo Molteni May 08 '09 at 17:12

8 Answers8

4

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.

splattne
  • 100,048
  • 51
  • 202
  • 247
Nick Berardi
  • 52,504
  • 14
  • 109
  • 135
2

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

devio
  • 35,442
  • 6
  • 73
  • 138
  • 3
    It's just... they seem so unnecessary, if there is only one assembly. And synching over FTP is a PITA... – splattne May 12 '09 at 19:10
  • 1
    they are NOT unnecessary! Try reading the quote you pasted by Rick Strahl again. Without the .compiled files asp.net has no way of knowing which ascx, aspx, ashx etc. paths corresponds to which types. Have you actually tried reading the content of one of the .compiled files? It doesn't matter if you have one or 21242 different assemblies, you still need one .compiled file for each type that correspond to a as*x path. – Pauli Østerø Dec 10 '10 at 07:58
1

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?

Community
  • 1
  • 1
Zhaph - Ben Duguid
  • 25,726
  • 4
  • 75
  • 111
0

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
  • 90,304
  • 29
  • 114
  • 125
0

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.

mbillard
  • 36,360
  • 18
  • 71
  • 97
0

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.

Burak SARICA
  • 680
  • 1
  • 6
  • 25
0

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
  • 2,393
  • 3
  • 23
  • 37
  • 1
    The problem is, that this way the app doesn't work anymore. You need them if you have no other mechanism... – splattne May 09 '09 at 06:08
  • 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 May 09 '09 at 10:57
  • 1
    @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 May 13 '09 at 10:32
0

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.

William Yeung
  • 9,370
  • 8
  • 34
  • 41