2

i have publish my website. using publish website in vs 2008. Now i want to update a single file. So do i need to recompile the whole web-site and upload it to the server again, or i will just publish this single file and upload it to the server.

if i can compile a single file then how to do it, also how to update it to the server?

safi
  • 3,636
  • 8
  • 24
  • 37

2 Answers2

7

Depends on whether your web project is a web application project or web site project. If its a web site, then you can just copy your updated file to the server and ASP.NET will recompile it for you.

If your web project is a web application project, and you made changes to the code behind, you'll need to recompile the project, and redeploy the DLL.

Also, if you're just updating an ASPX page (not the code behind, ASPX.cs), you should be able to deploy it without compiling.

Justin Largey
  • 1,934
  • 1
  • 16
  • 21
  • @Justin Largey, It is a web project, so according to you,i will recompile the whole project and deploy it again to the server, also if you can tell me where are these DLL store? In Bin folder of project? – safi Apr 05 '11 at 12:22
  • The dll should be stored in a folder called bin. This folder should be located under the web project folder. If your entire solution consists of one project (i.e the web project) then you should see a file called .dll. Copy this file to your server and overwrite the existing one. BACKUP YOUR EXISTING DLL BEFORE DEPLOYMENT, just in case you need to roll back. – Justin Largey Apr 05 '11 at 13:19
  • @Justin Largey, When i compile my project it produces alot of .dll files. i cannot find the webprojectname in my project – safi Apr 05 '11 at 13:41
  • 1
    @safi just copy all those DLL files to the `BIN` folder of the website, and remove the DLL files that were there previously. – Shadow The GPT Wizard Apr 05 '11 at 14:28
  • @Shadow Wizard Thanks for your reply, i Copy all the dll file from the compile website Bin folder, took a back-up of the Bin-Folder on the Server and upload it to the Bin Folder replacing the old one, but it just me error?, Suppose i have images.aspx then i have aspx.cs file in my project (Just to be sure you get the whole scenior – safi Apr 05 '11 at 14:34
  • 2
    @sefi suppose you do the Publish on machine called `SefiMach` into folder `C:\Publish`. Suppose the website sit on `\\myserver\website\root`. What you need is to copy all DLL files from `C:\Publish\bin` on `SefiMach` into `\\myserver\website\root\bin`. If you made changes to `.aspx` files just overwrite the files you changed. You don't have to copy `.cs` files and it will have no effect, as the code behind compiles into the DLL files anyway. – Shadow The GPT Wizard Apr 05 '11 at 14:41
  • @sefi a quick way to capture all files needed for deployment (i.e. Dlls, ASPX, ASHX, images, css, js) is to right click on your web project, and select Publish... Change the Publish method to "File System" and set a target location to somewhere on your local drive. Click Publish. Go to the target location you specified via Explorer. You can copy all those files to your server and the project should run. Please be aware that if you're deploying to production, you compile to RELEASE mode, not DEBUG. – Justin Largey Apr 05 '11 at 14:51
  • @Justin I think (judging from his comments) that he is already doing this just don't know what files to copy and to where. – Shadow The GPT Wizard Apr 06 '11 at 06:41
2

If you frequently update your website, I recommend to Check Use fixed naming and single page assemblies checkbox.

This will generate seperate DLL for each code behind page,

Although you have to compile full project but you can upload only relevant file.

This is very helpful in case if many people are working in single project, everybody can change in their respective .cs file and publish their .cs file's DLL , this will not affect other people's DLL and thus functionlity will not break, unless DLL's or codebehind clashes with each other.

Imran Rizvi
  • 7,331
  • 11
  • 57
  • 101