Wednesday, December 17, 2008

PreCompile or Publish websites in Visual Developer 2008 Express Edition

One of the most wanted feature missing in Visual Developer 2008 Express Edition is precompiling/publish feature which is available in Visual Studio Professional Edition.

I don't want to deploy the website with code behind and class source files. So, I googled on this and found interesting sources online.

Have consolidated and below are the steps to precompile/publish your websites in Visual Developer 2008 Express Edition

  1. Launch Visual Web Developer Express Edition.
  2. Select Tools > External Tools to access the External Tools dialog.
  3. Type Pre-&Compile (non-updatable) in the Title text box. The ampersand in the title means that the character immediately after will be defined as a hotkey for the menu item.
  4. Click the browse button next to the Command text box and browse to aspnet_compiler.exe in the Windows\Microsoft.NET\Framework\v2.0.50727 directory.
  5. Click Open to select the aspnet_compiler.exe application.
  6. Type -p " in the Arguments text box.
  7. Click the right-facing arrow button on the right edge of the Arguments text box and select Project Directory, as shown in below screenshot
    1

You configure the arguments for aspnet_compiler.exe by using the menu to the right of the Arguments text box.

  1. Enter a closing quote at the end of the arguments you've entered so far. At this point, the Arguments text box should contain the following text:
    -p "$(ProjectDir)" 
  2. Press the spacebar to add a space at the end of the arguments you've entered so far, and then type -v / ".
  3. Click the right-facing arrow button at the right edge of the Arguments text box again and select Project Directory.
  4. Type \..\Compiled" after the existing arguments. At this point, the Arguments text box should contain the following text:

    -p "$(ProjectDir)" -v / "$(ProjectDir)\..\Compiled"

  5. Check the Close on Exit check box.
  6. Click OK to add the new external tool to the list.

You now have a new menu option in Visual Web Developer Express Edition (see below screenshot) that enables you to precompile your web application as a non-updatable application.

2

That's it!!! Now compile/publish your websites in Visual Developer 2008 Express Edition and start rocking!!!

35 comments:

  1. thank you very much for your nice article ! i used it on Visual Web Develpoer 2010 Express Edition.

    it's working fine !

    ReplyDelete
  2. Can work for VWD 2010 ? seems like the 2010 doesnt have external tools under tools menu.

    ReplyDelete
    Replies
    1. For anybody who's faced with this problem:
      Tools -> Settings -> Expert Settings

      This will show the External Tools under Tools menu.

      Delete
  3. reza, can i ask which compiler you select? the Microsoft.net 4.0 or the sample one which is 2.0 ? Now it's able to generate the compiled folder, but when i launch from browser, it prompt me something like "The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map." .. wondering what problem.

    ReplyDelete
  4. The PreCompile option appears on the Tools menu but when I select it a Command Window pops up for a second and disappears.

    Does this mean the application has been compiled?

    Which folder is it compiled into?

    ReplyDelete
  5. Thanks Swami, this is really handy :)

    Avron - the application is compiled into a folder called "Compiled", one level up from the project directory.

    For example, if your project directory is C:\WebSites\TestWebSite, you'll find the compiled files in C:\WebSites\Compiled.

    Hope that helps!

    ReplyDelete
  6. Hi,muneer here,application is compiled into folder called "Compiled".when iam running my files,its displaying as "This is a marker file generated by the precompilation tool, and should not be deleted!".and my all aspx files are of 1kb.and my besite also contains masterpage.

    ReplyDelete
  7. Hi, I'm complete novice in .NET. I've followed the instructions I think! I end up with an empty folder called "Compiled", what have I missed? And once the folder contains the files, how do I upload them to the web space? Sorry, I'm used to Dreamweaver on a Mac!!

    ReplyDelete
  8. Great!
    Really thanks a lot. It was more than usefull

    ReplyDelete
  9. here is the page where you will find the options for the compiler

    http://msdn.microsoft.com/en-us/library/ms229863.aspx

    ReplyDelete
  10. also, please make sure (if your app is data-driven and the database is in the app_data folder) to disconnect from the database before running the precompile as it will give you an "being used by another process" error and will not continue.

    ReplyDelete
  11. this looks good, but gives me two errors. The first is /Basket.ascx(1) error ASPPARSE: Could not load type 'ezone.Basket'.

    the second is/basket.aspx(1): error ASPPARSE: 'ezone.basket' is not allowed here becuase it does not extend 'System.Web.UI.Page'.

    My website is called ezone. I have a web page ShoppingBasket.aspx, which uses the class basket.cs

    On a separate note, I'm using access database files, will I be able to publish this for use? I wan to publish the website on this machine, so that it is accessible from elsewhere.

    Presumably this is compiling with ASP.NET v2.0.50727, is there a way to use v3.0 or 3.5? (Their folders don't have an aspnet_compiler.exe file)

    ReplyDelete
  12. I know this post is a little old, but if anyone is getting the message "This is a marker file generated by the precompilation tool, and should not be deleted!" when they try to edit an .aspx file after compiling, the simple fix is to add the -u parameter to the external tool.

    so, it should look like

    -p "$(ProjectDir)" -u -v / "$(ProjectDir)\..\Compiled"

    All the code behind files will still be compiled, but you can edit content and design elements through VWD.

    ReplyDelete
    Replies
    1. yes its working fine with the appended option.

      Delete
  13. Hello,
    However, a good wed programmer should expertise in web integration, CMS development and integration, social networking application, Zend, CakePHP, Symfony, Codeigniter and so on. So, hire a perfect PHP developer

    Hire Web Developer

    ReplyDelete
  14. Works perfect in Visual Web Developer 2010 Express. All you have to do to see "External Tools" is changing "Settings" to "Advanced Settings".

    Thanks a lot!

    ReplyDelete
  15. Hi..is there an option to hold the console window that comes up.. cos i would like to see when warnings are raised .

    ReplyDelete
  16. This is a must read blog. The technical help presented on this blog is just so amazing. I don’t know where else I would have got all the information I had, but from this article. I count myself lucky for having come across this great work. I’m so impressed with this blog.
    Hire web developer

    ReplyDelete
  17. after compiling....what has to be done to upload this site on web server.HELP anyone PLEASE

    ReplyDelete
  18. Nice your blog has many valuable info's posted...
    Good work...
    hire web developer

    ReplyDelete
  19. Thanks for the article :-) Still useful after nearly 4 years!!

    Have just compiled on VWD 2010, but it only worked when I selected the aspnet_compiler in the v4.0.30319 directory.

    ReplyDelete
  20. hi!!i am working on vwd 2010...followed all the steps...a new tool is now available in my tools menu...it does show some kind of a compilation window for a split second but cannot find the 'compiled' folder anywhere...help please!!
    PS-working on a database driven website

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. check inside your project directory i.e. C:\Documents and Settings\\My Documents\Visual Studio 2010\WebSites. but this trick is deleting all of the data from aspx files in VWD2010.

      Delete
  21. That was a lovely concept. Thanks for sharing the same here.
    Web development Company

    ReplyDelete
  22. worked like a charm on the VWD 2010 with the new option
    -p "$(ProjectDir)" -u -v / "$(ProjectDir)\..\Compiled"

    thanks to all for sharing such a topic.

    ReplyDelete
  23. its grate article working fine for me on VWD 2008 .... :)
    Sir, i have 1 question i want to deploy this complied web application on godaddy server how to do this?? if any idea please help me.

    ReplyDelete
  24. Moneylenders offering these sorts of here and now credits can be discovered online and in customer facing facade areas. https://www.usacheckcashingstore.com/san-diegowww.usapaydayloanstore.com/chicagowww.usapaydayloanstore.com/chicago

    ReplyDelete
  25. Moreover, most moneylenders will expect you to think of them a check for the measure of the advance in addition to charges, which they will hold until the point that your next payday at which time they will store the check and get their "pay back."
    Check Cashing Corona

    ReplyDelete
  26. On the off chance that you are considering getting a loan credit, there are various contemplations that you have to investigate before you round out that application frame. Payday Loans near me san diego

    ReplyDelete