Reputation: 1412
Where I work, we do a very large number very small ASP.NET apps, and it has happened a few times that sites have been deployed in precompiled format, and the app needs to be changed, but the version of the code available in source control is out of date and the developer is not available. The app's dll has to be decompiled and hacked back together.
Ideally, it would never happen that a develpoer rushes a change through testing and production and skips checking in the change, we have since made changes to our policies to keep this from happening, but I wonder if the overhead of compiling a site on the server whenever the app pool restarts is a big enough problem that we should avoid uploading our code directly to the server. It would be easier to check the version in source control vs the actual live version if we could download the live source.
What are the advantages of precompiling VS uploading cs files directly to the server and having them compiled there?
Upvotes: 11
Views: 2044
Reputation: 17749
I disagree with most of the answers given to this point. There are many advantages to precompiling over ad-hoc posting of files, not the least of which is that the code in the production and testing environments stay more or less in sync. Pre-compiling makes it certain that the code you tested is the code going to production every time.
The issue you are running into is not one of pre-compile versus first-run compile. Instead it stems from the type of source control you are using. If I had to guess (and I do), I would say you are running Visual SourceSafe. If you were to switch to a source control system that made branching and merging trivial then you could separate your code into stable
and development
branches. Bug fixes happen against the dev
branches (which then get merged back to the stable
branch once validated). That way, untested or otherwise not-ready-for-prime-time code does not end up on the production server and you always have a copy of the stable
set to work from.
Upvotes: 8
Reputation: 19
The first thing that comes to mind is:
Ad Hoc Hacking the Code that's out of control.
End Users are Stake Holders and are the object of a developer's Fiduciary Responsibilities. Developers should take advantage of ever opportunity to improved the efficiently of their products.
DISCLAIMER: These comments are stated "as is" and I don't give a damn if you spell check me.
Sincerely,
DrFunkie
Bad Speller, but damn good developer. :)
Upvotes: 1
Reputation: 1534
I upload files without precompiling: in this way, since my code is very buggy, i can correct it with Notepad++ directly from the server
Also, Visual Web Developer 2008 (the free one) does not have the compiling option :-P
Upvotes: 0
Reputation: 22250
From purely an ease of use standpoint, I do like simply uploading the source files to the server and forget about pre-compiling.
This is what I do for all of the sites I manage, even the big ones. I do try to make a habit of hitting the more important pieces of the application to make sure everything works (and to compile them while I'm at it).
And here's another thought. If the site is public you can let the w3c link checker loose on it. This will have the effect of compiling every page it hits. And it's a nice thing to do anyway to ensure you don't have any broken links.
Simply put, I suppose these routine checks almost eliminate the problem of slow first-visit-compilation from your users. And since it's a good routine to follow anyway, it has worked out well for me.
Upvotes: 1
Reputation: 7930
The main advantage is in compiling performance on webserver. Also it protects your code, because it is harder to read the code from assembly :-)
Upvotes: 0
Reputation: 1684
It would depend on the size of the applications and the frequency of use. If it's being used regularly enough that the app pool is only recycled at the end of the day, a brief wait on first launch in the morning may be worthwhile. If it's only getting hit once every 30 minutes, forcing a recompile each time, it may be worth precompiling.
Of course, if it's a very large app that takes a while to compile on first run, I'd lean towards precompiling, especially if it's not getting constant use.
Upvotes: 0