Microsoft Visual Studio 2010 – How to pre-compile your “Web Site” and FTP only portions of your site to your Host.

You decided to build a “Web Site” and not a “Web Solution”. You proceed to use the PUBLISH utility in Visual Studio and publish your entire site to your host. You later make a change to your Web Site and discover that using the PUBLISH utility will only publish the entire site all over again. I don’t have to tell YOU why sometimes that causes headaches. What publish does is actually wipe out CLEAN your entire virtual folder.

How to get around this?

Pre-compile your Web Site and FTP only the updates.

How is this done?

Initially publish your Web Site from Visual Studio with the option checked – “Allow this precompiled site to be updatable. This will publish then entire site but also allow you to later “update” the site using the pre-compile feature.

1) Create a new folder on your hard drive that will contain the destination of your pre-compiles.

2) Make a change to your website.

3) Run the pre-compiler:

C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler -p c:[your web site folder] -v / c:[your web site precompile folder] -u

Note: Depending on your version of visual studio affects the framework sub folder name. Replace [your web site folder] with the path on your computer where your web site files exist. Replace [your web site precompile folder] with the path on your computer where your pre-compile will be generated after running the pre-compile.

3) Sign on to your favorite FTP and overlay just the dll’s in the bin folder and all your aspx pages.

Note: Why aspx pages? Because the pre-compile replaces in the Page declaration of each aspx page, CodeFile=”xxxx.aspx.vb” with inherits=”xxxx_POST, App_Web_????????” In other words, it replaces the name of the vb code behind file with the actual dll it executes.

That’s it.

 

Leave a Reply

Your email address will not be published. Required fields are marked *