Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I deploy Asp.Net project in Visual Studio 2015?

I have always used the express versions of Visual Studio for my Asp.Net projects. In the past, I would use a basic FTP synchronizer to push updated files (*.vb) to our server, then the changes would just show up on the website instantly. Now, for some reason, when I make changes to our *.vb files, they are not being reflected on the server after I synchronize over ftp, unless I build the project first. In addition, for our .Net 4.0 project, VS 2015 14.0.23107 is adding the following directories, with tons of stuff inside of them:

/.vs

/My Project

/Obj

There are loads of files within these directories which I have no idea what they do, and for some reason our project has taken on a completely different behavior. Now when we try to synchronize over FTP, there are a ton more files, and it seems that changing the actual underlying source doesn't work. We have to synchronize all the other files in the above directories, then we can see the changes.

Is this a new way they are doing things, or is this because VS is now free and we are getting a better version where we have to "publish" not "synchronize?"

Is there a way to go back to the simple way of doing things, where we just have a plain directory with our source files and sync them over to the server? Should we not do it this way? If not, what method should we be using and what files should we be pushing to the server?

like image 349
wayofthefuture Avatar asked Oct 24 '15 19:10

wayofthefuture


People also ask

How do I deploy a Windows application in Visual Studio 2015?

Step 1: Go to Visual Studio 2015 update 2. Select New--> Installed --> Visual C# --> Web--> ASP.NET Web Application (as shown in the image below) and give a name to your project. Select the appropriate location to save your project. Give the solution and project the same name.


1 Answers

I'll just promote my comment to an answer. There are several aspects of this question:

  1. Use publish, this feature is already for long available in Visual Studio and works well. There is plenty of ways to customize it and it supports a lot of technologies, including FTP. It's also more convenient, systematic and reliable way of deployment than manually copying files to your FTP. You can also share your publishing configuration among developers and store several of them. No loss here.

  2. I don't quite get why would you like to copy the source (.vb) files to the server. What you would usually like to achieve is to get compiled DLL's + resources copied to your server, and source files 'secure' on developers machines. You can compile your sources on the server if you really need it, but then just plug it into a source control, use ms build etc. Anyway, build/publish actions are there to prepare the deployment files for you, manual copying is pure bad.

  3. For the new folders:

    • Obj is everything but new, its created to store some resources, crap, more here: What is obj folder generated for?

    • .vs stores user specific settings, and you should ignore it as well as obj folder, more here: Should I add the Visual Studio 2015 .vs folder to source control?

    • My Project is most likely your own folder, nothing related to VS.

To sum up, as long as you use asp 4, 4.5 nothing changes. Only the 5.0 intruduces a bit different rules for deployment. Most of the problems you get are easily solved using the right tools (Publish). It will know what files to ship (binaries + resources included in project) and what to ignore (source files, caches, crap). It's convenient, less error-prone and can do much more for you.

like image 174
mikus Avatar answered Oct 06 '22 07:10

mikus