Taken over app...questions about Visual Studio 2013 RRS feed

  • Question

  • User597793452 posted

    Hi there! I've taken over support of a website built in an earlier version of Visual Studio and migrated to VS2013. It is running on an IIS 2012 server and built on ASP.NET. I am new to this environment, and have literally spent days watching Lynda.com videos to try to understand it! I think I get a good chunk of it, but am wondering if someone can answer a few specific questions that I have?

    What is the difference between Build and Publish? Do I need to build and/or publish the entire site every time I change a file?

    If I change one of the .cs files (controller) that is referenced in a .cshtml file, again, do I need to publish the entire site, or can I just publish that file? Having asked that, I tried publishing the .cs file, and it created a new file that is not in the location that I know the original file is in.  It published it in the website directory, but the file is located in another folder on the server. Or, can I just publish the .cshtml file (I know, this refers to  my previous question! :-) )

    Thanks for any help on these...I don't want to break the site, but I've made a change to a controller, and I just need to publish it!

    Tuesday, October 6, 2015 9:47 PM


  • User-821857111 posted

    When you Build the application, you compile it from source code (the .cs files) into dlls. You can build in either debug or release mode. For deployment to a web server, you should choose Release mode. Publishing generates a build and deploys it to the location you specify. I tend to choose a local file system location and then use an FTP client to get the compiled app up to a web server. You can find out where the app will be published to by clicking the Publish option on the menu and then looking at the Connection settings.

    An MVC site needs to be built every time you change a .cs file (e.g. controller) and you want to see that change take effect. You also need to republish the site when you make any change to any of those files if you want the changes to take place on the live site. You can make changes to .cshtml files and then just upload those to the server without building or publishing, but only if your views are not precompiled. You can determine whether they are by looking at the .csproj file to see if the <MvcBuildViews> section is set to true. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 7, 2015 2:19 AM