How do I prevent IISExpress & My Web Sites folders from cluttering up my My Documents folder? - asp.net

I noticed recently IISExpress & My Web Sites folders are getting added to the My Documents folder on my Windows 7 machine. I recently installed VS2012, so I'm guessing that's the culprit, but I haven't been able to find anything on line that explains how to change these defaults, if possible.

Microsoft cluttering up my 'Documents' folder with all their programs' (junk) folders drives me insane as well. I have conceded somewhat by creating a Data folder under my Documents folder, where I am pointing all MS apps (and others apps such as Firefox's profile folder) to for all their (generally unwanted) folders, and with a subfolder created for each program/suite. At least this way I can easily back up all settings when I back up my 'Documents' folders.
Anyway, VS2012 installs IIS Express, which is what is causing these folders to be created. I have found two solutions for dealing with the unwanted folders.
Uninstall IIS Express. You can do this from the normal Windows 'Uninstall a Program' part of Control Panel.
Change the folder location that IIS Express uses, as follows. Be warned: anyone doing this risks causing problems with their computer if you don't know what you are doing, so you do so at your own risk. Please make appropriate backups along the way as well too!
a) Close Visual Studio.
b) Create a new folder for the IIS Express sub-folders:
eg. D:\My Documents\Data\Microsoft\IISExpress
c) Move the existing unwanted IISExpress subfolders (config, Logs, TraceLogFiles) from your My Documents > IISExpress folder to the folder created in step b).
d) Create a new folder for the My Web Sites folder, I suggest also under the folder created in step b).
eg. D:\My Documents\Data\Microsoft\IISExpress\Websites
Under this folder, create a website for the default IIS Express website (in case it "auto-magically" reappears it's ugly head again later on).
eg. D:\My Documents\Data\Microsoft\IISExpress\Websites\Default
e) Go to the newly located config folder at:
eg. D:\My Documents\Data\Microsoft\IISExpress\config, and:
i. Open the file applicationhost.config in your text editor (eg. Notepad).
ii. Find the node sites > site > application path > virtualDirectory path for WebSite1, and change the physicalPath value from %IIS_SITES_HOME%\WebSite1 to the IIS Express default website folder you created in step d).
Eg. %IIS_SITES_HOME%\Websites\Default.
Note that %IIS_SITES_HOME% points to your 'Documents' folder (this appears to be a "feature" of IIS Express, I can't find a way to change it, and it appears to be auto-configured when IIS Express starts up, which it does by using the applicationhost.config file).
Do the same for any other sites created by IIS Express.
f) Create a new registry entry pointing IIS Express to the new folders you created (partly explained by MS here: http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-80-express-readme). FYI the registry key doesn't previously exist, as IIS Express uses a default of my Documents unless this key exists:
i. Open the Windows 'Run' box, eg. (Windows Key) + R
ii. Type regedit
iii. Navigate to key: HKEY_CURRENT_USER\Software\Microsoft
iv. *Right click* the Microsoft key (that you have just navigated to), and choose: New > Key
v. Type IISExpress
vi. *Right click* the IISExpress key that you have just created, and choose: New > String Value
vii. Type CustomUserHome, and hit the Enter key to save it.
viii. Double-click the CustomUserHome string to enter a value for it, and for the Value Data: field, type in the path to the new IIS Express folder you created in step b), for example: D:\My Documents\Data\Microsoft\IISExpress. Press OK, and you can now close the Registry Editor.
g) Reopen Visual Studio, and it should start using the new folders, as well as not create the folders in your Documents folder anymore. Yay!!!!!
FYI, when I did this all, I actually did it in a slightly different order (creating the registry key first), but this order was the easiest way to explain it all. Whether you create the key first or last shouldn't matter, as long as you do all the steps. Good luck!

A Tricky solution
Make a copy of your C:\Users\<user>\Documents\IISExpress folder
first
Create a symbolic folder called IISExpress inside the C:\Users\<user>\Documents folder using the following command
mklink /J C:\Users\<user>\Documents\IISExpress D:\IISExpress
Move all the content from your copied IISExpress into D:\IISExpress
Thats all

If you're just looking to declutter your Documents folder, one simple workaround is to set the unwanted folders to hidden so it's no longer visible.
You can do this by right clicking on the IISExpress folder > Properties and checking the hidden property at the bottom. The folder will still remain in your Documents folder but won't be visible to you. If for some reason you want to access these folders again, you can toggle hidden item visibility in File Explorer's View tab.

Related

How do I reset Visual Studio 2013 completely

Okay so I'm trying to create a new website, and the first time I created the site I accidentally saved it to the wrong folder. Well instead of just copying the folder to the correct location and having to deal with that headache I decided to just delete the old folder and make a new site in the correct place. Now it keeps giving me numbers at the the end though. I named the site PNI (and I like that name and want to keep it) so when I made it the second time it named it PNI(2) I tried deleting that and resetting then environment, removing the old site names from the "recent" list, but it named the site PNI(3). How can I reset VB so that it will stop counting my sites?
I can think of 2 places you might need to check to clear out old sites
In VS, go to menu Tools > Options and then click the Projects and Solutions node and look at the path in Projects location. Go to that path and delete any folders you see for the previous PNI sites you have created.
Some of the configuration data may be saved in your local applicationhost.config file (if you set up these sites and used IIS Express). Typically one of these paths will get you there:
%userprofile%\documents\iisexpress\config\applicationhost.config
%userprofile%\my documents\iisexpress\config\applicationhost.config
Look for the <sites> node, and delete any <site> nodes under it which look like your PNI site.

ASP Site - Updating Dlls on Change

When I make a change to the a aspx.cs page in my website and then build I notice that none of the dlls in the Bin folder are updated, the only dlls I can see in there are the references the web app uses. I want to bring across this one change rather than redeploy the whole site so where are the changes being saved?
I've tried various things like build solution, rebuild solution, build website, rebuild web site.
Is it possible my dll is being sent elsewhere? How would I go about finding out where?
In Solution Explorer, on root project node, right-click and select Properties. Click on the "Build" tab and look under "Output" section. Here you will see the actual output path and can change it to your bin folder.
In Solution Explorer, on root project node, right-click and try to Clean solution and then again build whole solution.

Renaming virtual directory in IIS 5.1

I have taken a Branch of a Project from TFS. Another branch is already in my computer.
The projects contains a virtual directory which is hosted in my system's IIS (5.1) and takes path from there
After getting all files to my computer , VS 2008 says that the Virtual Directory already exists in the IIS and do I want to overwrite it?
When I select No it creates another Virtual Directory with the same name but with suffix _1
I don't like this name and I want to rename the suffix with _Branch_1
I tried by going to inetmgr and renaming the Virtual Directory -> Application Name in properties of VD.
But it does not take effect , I also saw it after browsing a test aspx file from the site , URL still shows _1 suffix.
Every time I rename the Application Name and open Visual Studio , it shows same message and adds new suffix e.g. _2 next time _3 and goes on.
Any idea how to rename it?
Check the Solution file in your project. What the virtual direcotry has defined, open it in notepad and check.
To rename the Virutal direcotry, stop the app pool associated with the application and then you can rename it.
hope it may help you.

How to get ASP.NET website precompilation to exclude a certain folder

The several different environments (e.g. live, demo etc) of my web app are differentiated by config settings in a folder called EnvironmentConfiguration. Whenever I update one of the sites, I delete the EnvironmentConfiguration folder from the precompiled site before copying the website files over (i.e. in order that the EnvironmentConfiguration folder in the deployment location is not replaced).
Just to save mistakes, is there a way I can get Visual Studio not to produce the EnvironmentConfiguration folder when it precompiles the site for me?
You could try a couple of things.
1) Right click on the folder in the solution and select exclude from Project.
2) Look at each of the files in the folder and set the BuildAction property to 'None' rather than 'Content'

way to excluding static folders like Images in publish website feature in Visual Studio 2010

In my website when deploying production most of the time I only need to deploy bin folder and just marker files if new pages added.Since my website contains gigabytes of images folder and static stuff not updates frequently, it takes ages to complete a one publish cycle in visual studio website publish feature is there workaround to overcome like excluding these static folders when website publishing
Thanks...
You could use the Web Site Copy Tool - deploying a web site using this tool only updates the files that have been changed.
After you connect to the remote site, each file will have one of the following statuses.
Unchanged
The file has not changed since the last time the file was copied.
Changed
The file has a timestamp that is newer than the timestamp taken when the file was last copied. If the same file has been changed in both the source site and the remote site and you synchronize these files, the tool prompts you to indicate in which direction you want to copy.
New
The file has been added since the last time the site was copied.
Deleted
The file has been removed since the last time the site was copied. These files are shown only if you select Show Deleted Files. If you synchronize a file that has been deleted in one site, the tool will prompt you to indicate if you want to delete the file from the other site.
See this article for further information
I don't know if there is another way. But if you make the folder hidden in the file system, then it would not be published.

Resources