How do teams work on VB ASP.NET MVC sites? - asp.net-mvc

In PHP, you can just log in to the FTP and see all of the files. I notice in VB ASP.NET MVC when I publish a site it doesn't include the controllers or models. Rather, it seems to compile them into DLLs. How can the files be modified with out access to the originals? Would a developer have to publish the files in a separate directory and then the other developer pull them down and open the project in visual studio?

Keep your SourceCode in a Version Control System like SVN /GIT /TFS etc.. Whenever you want to make an update , Get the specific version you want to update and make update to that.
Having a Version control gives you so many advantages
1) Collaborative working. Many members of a team can work on same code base without overwriting conflict
2) Restore to a Previous Version : Something wrong with the current production move ?. Just get the Previous version (Label) which is working fine (and was running in prod) and rollback to that till you fix the issue.
Keeping the Previous versions of code will save a lot of time in a Programmers / Team's life.
This SO question has good points about why we should use version control.
Version control is not only for Teams. Individual developers can keep their code in Version controls and sleep nicely
Btw, Your MVC project's Model classes and Controllers classes are compiled into the DLL files.

I've seen a lot of companies that work with Visual Studio implement Visual Source Safe.
information can be found here http://msdn.microsoft.com/en-us/library/3h0544kx%28v=vs.80%29.aspx
otherwise it's pretty much what Shyju said.

In a professional environment, there is a very clear distinction between editing source code, and deploying to production. You seem to make no distinction.
Usually developers make changes under careful control using a source control system like SVN.
Build & deployment is then done separately by a dedicated team member. Developers do not touch the production servers willy-nilly.
How can the files be modified with out access to the originals?
I don't understand. If you want developers to have full access to the production environment, why not give them full access to the source code as well? In your PHP example this is a given.

Related

Publishing from visual studio to windows server 2012

i have a Mvc 4 project i would like to publish on a windows server 2012. On the windows server 2012 i have setup IIS 8 and Sql express. Do you know of a good guide to set this up? My issue is that i can't get the database working. I would like to make it so i can easily publish changes to the website. Any ideas how to do this?
is it possible to setup Visual studios on the server for the nuget package console?
the only way i have got this working was to copy the entire database to sql express but if i change anything i have to do it agian. Not a very stable solution.
Best regards John,
It's not exactly clear what the problem is, but I'll try to give a couple of pointers.
First, nuget shouldn't be involved in the deployment per se; it's involved when building the project, but once you get a deployment package it should contain everything the project needs - look at setting up the deployment using the visual studio built in tools, i.e. see this MSDN link.
The database is a separate side of this. You say you can't 'get it working' which I can't really help with since there's no details - you need to be familiar with connection strings and change your connection string during the deployment so your app can connect to the right database. The publishing wizard linked above can help with this as well, or you can use config transforms, or any number of other mechanisms.
Documentation here has details about what you can do on the database side. The publishing wizard (when using web deploy) can read the database schema and even make schema comparisons so you can deploy schema updates, but I've never actually used that solution - I usually need more control over what happens so I manage my schema upgrade and downgrade scripts myself.
Since there are many problems compounded in this question I suggest you ask a separate, more focused, question about each one.

upgrading asp.net mvc apps

Upgrading MVC apps done with VS 2010 has been the biggest issue for me. I have an application that I use to run various websites and I maintain and develop this application separetely then upgrade the sites based on it. A lot of things might change during development of a new version - new Views, new Controllers, stuff added into JS files, updated stylesheets etc.
I've searched around the web but nothing useful came up besides this Haack's article but no source code is available.
I also tried making a Nuget package for the entire MVC app and while this works, it doesn't package up the resource files (an issue within Nuget itself) and my apps rely on those so until this is fixed I cannot use this method.
I checked how others do it and this pretty much summarizes Umbraco's way and it's the same painful way of a dozen of steps like I do it now.
Do you have any good advice on it?
You don't specify the target OS, but I create native packages, i.e. .deb for Ubuntu servers.
However this still means you need to specify all files, manage configuration, upgrade database schemes. But if you test this on a CI server it becomes more reliable, and you can do it iteratively. This is all part of good deployment practice. I can recommend the Continuous Delivery book.

How to easily include common code across multiple ASP.NET MVC sites

At work we have about 30 legacy sites which run from a common set of code, currently these sites are in cold fusion. For this common code we have one project, then in IIS we set up a virtual directory to include the common code into each site. This works great, as changes to core logic can be made in one place, and its replicated through all the sites. And as all of our sites are hosted on the same servers, we can also just deploy the common code and all the live sites are updated, we don't need to release every site.
However we are in the process of re-writing our sites and core code into c# and asp.net MVC 3. Its going well, except when we update the core code, we are currently copying the dlls into each site, recompiling, then releasing each site.
This is fine while we only have a couple of sites re-built with the core code, but is going to be very painful when all 30 of our sites have been re-built in .net.
Does anyone have any ideas of how to easily use and delpoy common code without having to copy the dlls to every site?
So far we've tried:
- using a virtual directory of the dlls (doesn't work as site code needs to be re-compiled, and IIS doesn't seem to like it on .net sites anyway)
- deploying our common dlls to the GAC - this is an issue as the third party libraries (eg nHibernate) aren't signed, so can't add them to the GAC too.
Thanks
Saan
The easiest way is to automate your update procedure.
But if you want to rid of copying at all then you can try thing named "codebase".
Here is description of "How the Runtime Locates Assemblies" and details of "Locating the Assembly through Codebases or Probing" http://msdn.microsoft.com/en-us/library/15hyw9x3(v=vs.71).aspx
Interesting.
I also saw in the next .net relase they have http://www.asp.net/vnext/whats-new#_Toc_perf_3 “Sharing Common Assemblies”
This will give us a couple of options to investigate thanks.

Group project via Team Foundation 2010

We will be doing a database driven logistics system for our Software Analysis and Design course. What we want to do is to work on the project simultaneously so that we can finish the project earlier. Is TFS the right tool for this? If yes, how do we start? What are the steps to set up the TFS? We use VS 2010.
Thanks.
This is a very broad question. TFS is an excellent code repository that does allow for multiple developers to have a centralised code base (which sounds like what you are after).
The first thing you will need of course is the TFS 2010 installation disk and ideally a separate box to install it on. Although the installation and set up can differ slightly on differing OS, i would recommend following the installation guide here and posting any specific and more detailed questions as you come across issues.
Is TFS the right tool for this: Maybe. It may be a bit much overhead to use for a course.
How do you start: If you have Visual Studio 2010 Ultimate, TFS should be included. Everything is installation wizard based, and the install (can) give you everything you need. For what you want, a stand-alone installation using SQL Server Express should be fine.
If you're looking for something lightweight that you all could use for source control, you might want to consider some of the git/svn hosting services (e.g. http://unfuddle.com). There's no direct integration with Visual Studio without a third-party tool, but it will give you the basics of being able to share source code among your team.

Best way to share an ASP.NET MVC Azure project among 3 PCs?

I zipped an ASP.NET MVC Azure project up and copied it to another computer (both have VS 2008). I thought I could just unzip it in "Documents\Visual Studio\Projects", but I can't quite get it working. My site builds, but the browser doesn't see the master page or Site.css. Should moving projects around as Zip files just work?
My real question is, what's the best way for one developer to share an ASP.NET MVC Azure project among 3 different computers? Should I use something like Dropbox or Live Mesh? Or, github maybe?
OP here. The problem was that "Static Content" was not enabled in IIS on the second computer. The latest installation instructions for Azure (March '09 CTP) omit this crucial step. The first computer originally ran the Jan '09 CTP, whose instructions included the step about enabling Static Content. Moving projects around by zipping them up seems to work fine.
I love using git and github. I've shared my code among many computers with it. This was C# with Visual Studio solution files, so it sounds very similar to your situation.
Of course, I love git for source code management. I'd recommend it to anyone, but there's a decent learning curve if you're new to it. I can recommend resources that helped me, since it was really only about 8 months ago that I delved into it for the first time.
If you're not looking to adopt git as your source code management tool, then you might want to look at other options for moving code between machines.
Perhaps your IIS virtual folders are configured differently on the machines? You said it builds, but does not run. This suggests that configuration of the web site itself might differ between the 2 machines (and we're getting into some things I'm not aware of about how ASP MVC works at this point).
Yes, moving projects around in a zip should work assuming all of your files are in the subdirectory you zipped up. Sometimes you might add files to your solution that aren't in the subdirectory, and that can cause problems. References to other files need to be relative, instead of absolute.
A problem you might encounter is if both of you edit the same file, or accidentally overwrite an edited file with one from a developers machine that doesn't have that change yet.
Most developers use a source control system to share projects. Git is a fairly new one that has a growing audience. Subversion has been around a little longer and is very popular. Visual Studio integrates with TeamFoundation Server.
ProjectLocker.com offers free subversion hosting(so that you don't have to setup your own subversion repository).
Codeplex.com offers Team Foundation Server hosting for open source projects.
It sounds like the type of thing you see if the app-root isn't an application, or if the application isn't handling virtual directories correctly.
With virtuals; for example, you should rarely use "/foo/bar" - because if your app isn't installed at the site root you'll get unexpected behaviour - you mean "~/foo/bar", but this often needs extra code, as discussed here.

Resources