Visual Studio 2012 changes IIS application directory without asking - visual-studio

If you have a solution with web applications configured with IIS, Visual Studio will set up the virtual directories and point them to your code. If you have multiple branches for that solution, there will be different directories for the same IIS applications. If you open up a solution from a branch different from the one the IIS applications are currently pointed to, VS2010 would warn you and then ask if you want to change the directories. VS 2012 doesn't warn you, it just changes the directories with out asking.
Is there any way to get that warning back? Is there a way to set VS2012 to not change the directories or a tool to do it manually?
Quite often I am working in one branch but I want to look at the code in another branch. If I open that branch up in VS2012, it changes the directories in IIS and now the applications are pointed at the wrong code. 2010 would ask me so I could tell it 'no' if I didn't want it to change directories.
Thanks,
Matthew

Related

Prevent Visual Studio from automagically changing the physical path of IIS virtual directory?

I have a Visual Studio "solution" which contains a Web application project (among a few other projects). Visual studio "typical" setup seems to be to insist that the output directory for binaries is smack in the root of the project source directory. In particular, each time the web application project is opened, Visual Studio will reset the physical path of the IIS virtual directory to point to the project directory.
This is problematic on many levels:
It's never wise to mix binary output directories and source trees
If the web application is buried deep within a directory hierarchy of other source, wherein many projects produce libraries which may be used as support libraries in the web application, then all the other supporting projects must have their binary output directories set to a bin directory a some non-obvious, nonsensical location somewhere in the source tree.
This "typical" VS setup does not have your web app setup duplicate the "production" setup you would get from a publish: there may be files in your source tree (an old .js file there there from a repository extraction, for example) that are not referenced in your projects, and so would not be in the production published package, but are there in your debugging setup.
It is very possible and very easy to configure all the projects in a Visual Studio solution to build to a bin directory in some subdirectory cleanly placed outside the source tree. It is also easy to ensure that the web app build places all content cleanly in this directory. It is also easy to configure an IIS virtual directory to point to this build output directory. And then Visual Studio, unannounced and unbidden, screws this up by arbitrarily changing the physical directory of the carefully configured virtual IIS app, to point to the middle of one's source tree.
How can this crazy-making behaviour be stopped? I.e. how do I prevent Visual Studio from automagically re-setting the physical path of the virtual web directory each time the web app project is opened?
This question has been asked many times here on Stack Overflow, but I have seen no real answers:
The response to this question (IIS8.5 is automatically changing Physical Path property) simply indicates how to control the order in which Visual Studio does its repointing.
This question and response (Visual Studio creating IIS virtual directories when solution opened) simply confirm the behaviour.
The response to this question (Opening projects changes iis settings) is simply wrong, as are some of the comments.
These questions (Visual Studio 2012 changes IIS application directory without asking), (Visual Studio changes local IIS configuration) have no responses.
Basically, no one has said it can't be done, but no one has give a decent solution either.
I have my application in IIS pointed at %SystemDrive%\inetpub\wwwroot\web, and would like it to stay that way. Like others, I discovered that every time I opened the solution in Visual Studio (I'm using 2017), it would change the application's path in IIS to point to the path that Visual Studio uses.
I've made the following change to the project settings (web tab) for my project. In the servers section, I've set the drop-down to "External Host", and then entered the project URL as https://localhost/web. I'm now able to open the solution in VS without it updating the path in IIS.

Cannot edit source files locally without checking out file on TFS

Me and 2 colleagues are using TFS and VS 2013 on a shared project. Me and my Colleague "Bill" are able to edit files and check them in whenever we like. But colleague "Bob" cannot do this. They appear as "locked" in his solution unless he goes into TFS and specifically checks out the file. Me and Bill dont need to do this, we can simply edit the files and if we both try and check in the same file it notifies us of merges. Bob has the same TFS permissions as us, and as far as I can see the same visual studio settings.
Any ideas on what might be causing this?
This sounds like a workspace issue.
Bob needs to change his workspace from a server workspace to a local workspace. If he's using VS2010 or earlier, he will not have that option -- local workspaces are only supported in VS2012 or later.
Here's an MSDN link on how to configure local workspaces:
http://blogs.msdn.com/b/visualstudioalm/archive/2012/10/05/set-local-workspaces-as-default-when-upgrading-to-tfs-2012.aspx

Every time I open my project I have to create virtual directories

I am currently working on a solution which has an ASP.NET application and a Web Service. Whenever I open this solution I get the message that the virtual directories for this project have not yet been created and must be to continue. The problem is, if I hit OK, it cannot create the directories because they already exist and then I cannot load the project. Looking in IIS I can see that the virtual directory exists in C:/Inetpub/wwwroot/ProjName. If I delete this from IIS, I can then open the project, but it creates the virtual directory in C:/location of project folder. When it uses the project's location, I am not able to connect to the site or the web service.
The same thing happens on XP with IIS 5.1, VS 2010 and Server 2003 with IIS 6.0, VS 2010. Similarly, it happens on colleague's machines, so I am convinced that it is a setting in VS, and not IIS or my machine.
Right now, my solution is to delete the virtual directories, open the VS solution, delete the virtual directories, and publish the projects with the publish toolbar in visual studio (not the web tab in project properties).
I fear that I've at some point messed up a setting on both of the projects, but it has been some time since I've been working around this. I've scoured all of the settings and I can't find anything that fixes this behaviour. I need to pass the project along to someone else, and I feel as if the work around instructions may be confusing so I want to fix this.
I used to do things similarly back in the days when VS didn't have its own dev server - re: directly work on web projects in a local version of IIS (if memory serves, this was called "Personal Web Server" or PWS - am I advertising my age?)
Anyway, I haven't (thankfully) done that since VS (2005?) got its own dev server...
Try this process in VS 2010:
You can develop your solution on any local folder in your file system. You can run/debug your solution from VS (ctrl f5 or f5 respectively) - it will use VS dev server by default. Your development machine doesn't even need to have IIS...
After you are done developing and debugging (using VS and its dev server), you can publish to IIS or even to some other "publish folder" in your (local) file system, and simply copy the files to whatever (local/remote) IIS virtual (ASP.NET application) folder you prefer.

Using IIS Express with a team - when not using localhost

I assume we must be missing a trick as we are finding using IIS Express with teams quite painful.
The issue is IIS Express' applicationhost.config is stored locally in each persons MyDocuments folder, and thus separate to the Visual Studio solution and not in source control.
So when we make a change everyone has to manually update applicationhost.config on their machine.
THe update visual studio does to the applicationhost.config file fails, because we are not using localhost, we have host entries to give our environments different names.
Is there a better way?
Refer to Here
UPDATE FOR VISUAL STUDIO 2015: As was pointed out to me in a comment
by Søren Nielsen, in Visual Studio 2015 the IIS Express configuration
files have moved. They are now separate per project, and stored in
/{project folder}/.vs/config/applicationhost.config. Which is much
better, in my opinion, just don't forget to add .vs/ to your
.gitignore/.hgignore files!
Other wise NO there is no better way. Instead of IIS Express, for remote access you can use IIS on your development machine...
It doesn't seem a big deal: when you load a project configured to run with IIS express, VS checks your applicationhost.config for that entry. If it doesn't find it, it just prompts you with the problem and asks you if you want it to create it for you. Just click "yes" and the entry is added.
At least, that's how we deal with that here. The problem is just the first time anyway, all other settings are stored in web.config in the project, which is versioned, so everything should be smooth.

Project management with Visual Studio, without TFS?

Can I have some basic project management in Visual Studion without TFS or is TFS what I need?
Basically I like to get a list with my projects, last edited dates, and if possible project tags (customer for example), and when selecting one VS should load it. From the right repository (Mercurial/Git/Svn). I can move my project to some repo host if they have this solution (Addon).
At the moment I handle the projecs manually with Windows standard folders + SVN/Hg in folder context menu, and thats a headache.
Thank you
As far as I know Visual Studio doesn't support that functionality natively.
TFS isn't my forte but I know it comes with MSDN subscriptions and the retail version is around $500 if that is the path you are interested in. If you do go the TFS route you have an option to use TFS Basic during install which is a greatly simplified install of TFS that can even use SQL Express.
You can check out pricing and download the trial from here if you want more info:
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/team-foundation-server

Resources