locked
Confused over Website project advantage over web project RRS feed

  • Question

  • User783886866 posted

    I have an exisitng site which I have to manage that is a website project not a web application project

    I am using visual studio 2010.

    I have read the MSDN differences here:http://msdn.microsoft.com/en-us/library/dd547590.aspx

    The advandatages of a website project from this MSDN page:

    "The source code is typically compiled dynamically (automatically) by ASP.NET on the server the first time a request is received after the site has been installed or updated."

    "It is easy to update a Web site in production. You can update individual source code files on the production server without having to explicitly recompile the site. You can update individual files that are ready for deployment even if other files are not ready due to compile errors. You can also open the Web site on the production IIS server directly in Visual Studio and update the Web site in real time."

    "Advantages of the deployment strategy for Web site projects include the following:

    •  

      If you make a small change to a Web application, you do not have to redeploy the whole application. Instead, can copy just the changed file or files to the production IIS server. You can also edit files directly on the production server. (Because a Web application project's code files are compiled into a single assembly file, you must deploy the whole site even for small changes, unless the only change is to an .aspx or .ascx file.)"

    However when I deploy my code using VS "publish web site" menu it still precompiles the codebehind pages into dlls in my BIn folder. This then does not work as described in the MSDN article in bold  as 1. it does precompile and 2. I would like to change one file i.e. aspx.cs and just publish that file without having to publish the whole site but I can't.

    This means when publishing to a local folder I have to copy all files over (dlls and aspx,ascx pages) as the references to the codebehind dlls would have changed.

    Building the site in release mode and copying those files to the server is a way to get past this.

    If this is how website projects work then I can't see the point of website projects it precompiles but does not come with the advanced deployment options.

     

    Thursday, April 28, 2011 9:51 AM

Answers

  • User-1704326042 posted

    Hello Madlo,

    It can be confusing at first.

    If you want to deploy the website, with the source, you can use the "Copy Web Site" tool from the WebSite Menu.

    The publishing option automatically precompiles, on the other hand, "Copy Web Site" will keep your source.

    If you still choose the publishing option, it is better to "use fixe naming and single page assemblies", to know which dll corresponds to wich page or user control.

    hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 28, 2011 12:18 PM

All replies

  • User-1704326042 posted

    Hello Madlo,

    It can be confusing at first.

    If you want to deploy the website, with the source, you can use the "Copy Web Site" tool from the WebSite Menu.

    The publishing option automatically precompiles, on the other hand, "Copy Web Site" will keep your source.

    If you still choose the publishing option, it is better to "use fixe naming and single page assemblies", to know which dll corresponds to wich page or user control.

    hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 28, 2011 12:18 PM
  • User783886866 posted

    It clears it up from the MSDN article it sounded like you had website application deployment only works one way where pages are compiled when needed on the server. This is not true since website application projects can be deployed (copy of the website menu)   or copying the release folder as well as through precompiling by publish projects menu. Web application project does not have the Website menu so does not have the option of copy website but you can also copy the release folder files to simulate this.

     

    With publish website you can use "fix naming and single page assemblies" which adds the full name to the compiled dll in addition to that random code e.g. App_Web_document.aspx.61ab436f.dll. So as I understand each time it publishes it will regererate those random codes? What I want is to only copy the aspx and aspx codebehind dll so it won't have to publish the whole site with all users losing their sessions ie. the site having to be offline. I can do this nowbut it is still easy to make a mistake as I have to copy the bin folder dll and then the aspx page. Would have been nice if this was build into the publish website option so have the advantage of precompiling and deployment flexibility in one.

    Friday, April 29, 2011 3:26 AM