Transfer the VS project to the website

If you started developing a project, how difficult is it to switch to the website development process?

+4
source share
2 answers

Transferring a web application project to a website is not so difficult, but may have several fixes. However, keep in mind that website designs have certain disadvantages. Their folder folders are messy, code reuse is more difficult, with the exception of a disciplined software architect, websites cannot use MSBuild events before and after assembly, etc.

Some things to consider when converting a site:

  • Create a new website in a different folder and copy the appropriate files into it. It is not practical for a web application project and a website to coexist.
  • Websites do not use the .designer.cs file for custom controls, master pages and pages, so you can destroy them.
  • All codes that do not contain a code must be moved to the App_Code folder or to the library with links so that they are accessible to all pages.
  • Web service code encoding must be moved to the App_Code folder.
  • Service links must be removed and rebuilt.
  • Re-add the links to the website, as for the web application project.
  • No need to strictly declare namespaces for code-based classes, but it is also not necessary to delete existing namespace declarations.

Most likely to bite:

  • Pages no longer know about each other. In a web application project, all the code is in one assembly and therefore easier to share. There is one assembly per directory / subdirectory on the website.
+1
source

I would like to add to the steps given here. In the web application, all the code behind in one dll, where there were websites, has a separate dll for each page or folder, so there is no inherited tag on the aspx page for the web application project, delete all the inherited tags and put the file code = ". .... aspx.cs "in the page directive. While you are publishing or precompiling the website, these inherits = ".... aspx.cs" are replaced with the compiled page type in the page dll.

0
source

All Articles