Last post Oct 07, 2015 02:19 AM by Mikesdotnetting
Oct 06, 2015 09:47 PM|nightowlres|LINK
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!
Oct 07, 2015 02:19 AM|Mikesdotnetting|LINK
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
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.