VS2015 annoying message about IIS Express - visual-studio

I use devenv.com to build my projects from the command line. For various reasons I do not use msbuild for that.
The problem I have with VS2015 (not VS2013) is that I sometimes get a dialog like this:
The only way known to me to make it go away is open the VS 2015 GUI and build the solution there. It needs to be done just once, but it is annoying in the first place, because the command line build is stuck until OK is pressed. Plus this could happen again.
A few notes about my setup:
IISExpress. Please, do not suggest moving to IIS.
We do not use the local applicationhost.config from the .vs folder. The global one from %USERPROFILE%\Documents\IISExpress\Config is used instead. We enforce it for all the projects in all the solutions by including <UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile> in each and every project (through a common targets file).
My command line build script knows to create the web application site in the global applicationhost.config, so in VS 2013 the script could be used even if no sites were initially configured - they are configured on the fly, just like VS 2013 GUI does. However, this no longer works in VS2015 - it opens this bloody dialog.
What additional command line configuration needs to be done to avoid this dialog?

When you open VS 2015 for the solution, the first thing it does is to repopulate the applicationhost.config file inside the local .VS folder. But if you rebuild your project using Devenv.com command line, it will not automatically regenerate the .vs config file correctly.
So I agree with Lex Li, we might ignored a few inconformity. You can try to closed Visual Studio and then deleted the entries for your site in the applicationhost.config. Then opened project in Visual Studio and reconfigured everything before trying to run it. Or using devenv.com to build a new projects from the command line.

I just copied the applicationhost.config file from the project directory ...\.vs\...\configfolder to the IISExpress config folder located under %USERPROFILE%\Documents\IISExpress\config.
So I overwrote the global config applicationhost.config file, but in my case it was OK as it is the only VS project on my computer.
Careful when doing this when you've got more projects on your computer as connections may break.

Related

Visual Studio 2015. Files not added to TFS

I'm using Visual Studio 2015 update 3 with TFS hosted at visualstudio.com.
When I add a C# class file to one of my projects in Visual Studio, it's not automatically added to source control. For other projects in the same solution, C# class files are added automatically, as expected.
When I then add the file, manually, in the project with this problem, I get the following question;
I have to confirm to add the file to source control.
There is a similar question (Visual Studio 2015 new files not being added to source control automatically), associated with a "release" branch, which is not the case here (at least I think so - our TFS-project has never been branched)
We've never configured any .tfignore manually.
This started to happen recently and occurs on all development machines, so it's probably not a client machine issue.
I'm clueless, so any help is highly appreciated.
UPDATE
I've discovered that the problem occurs in projects with names ending with ".Lib"
Projects:
Core (ok)
Core.Lib (files not added automatically)
Communication (Ok)
Communication.Lib (files not added automatically)
I tried to add a test project Test.Lib to my solution. This project was not added to TFS either, but project Test was.
The "lib" extension is the problem. Try renaming the project folder to something else, eg. "CoreLib".
To reproduce this behavior / bug, try the following:
Create a Test directory in a directory controlled by TFS
Create a Test.Lib subdirectory in this directory.
Add a file, test.cs, to Test.Lib. (Test\Test.Lib\test.cs)
In Visual Studio's Source Control Explorer, try adding the new Test directory to source control. You'll see test.cs on the "Excluded items" tab.
The "lib" extension is used by binary files, and these are ignored by Team Explorer by default. I haven't found an official list of filetypes anywhere, but other affected file types are dll, exe, obj and possibly others. You can include these files manually by right-clicking them and selecting "Include".

Copy/Move Visual Studio Projects/Solutions To Another Computer

So I have a handful of Visual Studio projects that I need to move to another computer. Is it as simple as a copy and paste or will that mess something up? Both machines will have the same version of Visual Studio installed, so that shouldn't be an issue.
Is there an export function that I've overlooked?
If the Visual Studio version is the same, you can just copy the project folder.
Till the time you are moving your solution file and associated files you should be good.
In case you are using any source control update your solution from there.
Hope you have the same VS version and any addon frameworks you have
You can directly copy the project to the projects folder. This worked perfectly for Visual C++ projects for me (and also some other projects). But when I copied my Cordova App from one PC to the other (Both had Visual Studio 2015), I wasn't able to open the project. Whenever I tried to open the project, trying both the ways - directly from the Project file and the open option in Visual Studio, it at first opened but when I tried to open a file, it just got hung and didn't respond.
This problem may occur because Cordova apps have some configuration files that might be different for different PCs. I am not sure that this is the reason for the problem.
A solution that I used was that I created a new Project and copied the files to the project folders (excluding the configuration files).
Can you save the file to cloud? if so then you could potentially upload the file to cloud and download the file to the new

IISExpress 8 Cannot read configuration file redirection.config

I'm running Windows Server 2008 R2 (x64) with IISExpress8 and when navigating to
c:\Program Files (x86)\IIS Express>iisexpress.exe
it says:
Filename: redirection.config
Error: Cannot read configuration file
Any ideas where to start?
I can't find anything...
I had a similar issue to #Myles J but renaming %userprofile%\Documents\IISExpress\config\applicationhost.config didn't work. What I had to do was the following:
Close Visual Studio.
Rename the %userprofile%\Documents\IISExpress\config directory.
Start Visual Studio again. The %userprofile%\Documents\IISExpress\config directory will be recreated with the default config files.
Copy the original applicationhost.config file over the autogenerated one.
Before anyone asks: the permissions on the folders were identical, the read-only flag was not set on the folder or its files, and I didn't modify applicationhost.config in any way.
After installing IIS Express, copy all files from
C:\Program Files\IIS Express\config\templates\PersonalWebServer
to
%userprofile%\Documents\IISExpress\config
Right click on your project file and Edit the project file and remove the URL from IISUrl and reload your project then it will work
I have just resolved this. It is a strange solution but it worked for me. Here are the steps I took:
Navigate to the folder containing the local IISExpress config files (normally My Documents>IISExpress>config on Windows7).
Find the applicationhost.config file. Rename it to something different e.g. applicationhost2.config.
Navigate to your web project in Visual Studio (I was using VS 2012). Right click on the web project and select Use IISExpress. Run the project. It should fail due to the renaming of the config file.
Change the name of the configuration file back to application.config. Ensure "Use Local IIS Web Server" is selected in the web project settings. Run the solution.
This worked for me.
If you do:
C:\Users\”username*****”\Documents\IISExpress\config
You find these file
applicationhost.config
aspnet.config
redirection.config
Delete above 3 file and then open the project.then the problem is solved. I tried, its working fine.
I have the exact same issue with Visual Studio 2013 on Windows 8.1
I map My Documents folder to SkyDrive, so the IISExpress folder was marked as "Online-only". Once I marked it as "Available offline" everything worked.
Visual Studio will only report the filename it looks for, not the full path. The problem for many users is that the IISExpress with the redirection.config can exist in multiple paths, including a OneDrive path which may not be synced.
To figure out exactly what file Visual Studio attempts to open, use the Microsoft (SysInternals) tool ProcMon. It lists all files and resources Windows tries to access. Add a filter for "Path contains redirection.config" and reproduce the problem in Visual Studio. Now you will see the actual path it tries to use.
In my case, I have multiple IISExpress folders. One that was synced to OneDrive and another one that was local. Visual Studio tried to access the OneDrive folder which was not synced to the local disk, and thus it failed.
In some situations simply renaming/deleting the applicationhost.config file isn't enough since VS won't always recreate it for you. I believe the following will fix it under all circumstances:
Close Visual Studio.
Make sure there are no IIS Express processes running, then delete C:\Users\XXXX\Documents\IISExpress\config\applicationhost.config (where XXXX is your Windows username).
On command line, execute c:\Program Files\IIS Express\iisexpress.exe. This will recreate the necessary configs. Press 'Q' straight away to end the process.
Open Visual Studio again and Start/Debug your web project. Everything should now be working.
Backup files at local IISExpress folder. It can be found at: C:\Users\”username*****”\Documents\IISExpress\config
Go to the location:
C:\Program Files\IIS Express\config\templates\PersonalWebServer
Copy the required files from this directory to the local IISExpress folder.
It worked for me after I copied over the files:
applicationhost.config
aspnet.config
redirection.config
In my case the 'My documents' folder for my work laptop was mapped to a network share. So when the work network was not available I was not able to open my solution.
Change:
These will have the value of my docs in network share. Change this to local
I. Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal
II. Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal
For eg:
Old value: \networkdrive\c$\Users\profile\Documents
New value: C:\Users\profile\Documents
See:
https://blogs.msdn.microsoft.com/chiranth/2015/04/01/error-while-runningstarting-a-website-under-iisexpress-in-visual-studio/
The issue is that the files in C:\Users\"Your Username"\Documents\IISExpress\config are encrypted.
Open this folder, Select all the files, Right click and select properties,
Click advanced, deselect "Encrypt contents to secure data, Click okay, click apply.
That will fix it.
Using Visual Studio 2013
I had to stop visual studio rename the whole config directory, Documents > IISExpress> Config then start a new web project, which fails but it recreates the config directory, then I rebooted and launched visual studio and everything worked!
I noticed this problem after copying a project between 2 computers, perhaps it was caused by a duplicate IISExpress port or something trivial.
Using VS2013 / Windows 7
Close solution. Open Windows Explorer and right-click on "My Documents\IISExpress\config" directory and select "Decrypt". Be sure "Apply changes to this folder, subfolders and files" is selected. Reopen VS solution.
In my case it happened when IISExpress was still active from a previous VS session and new instance of VS was run.
The solution was to stop (or kill) IIS Express instance.
Fix was really simple for me >> Restart Visual Studio
My setup:
Visual Studio 2015
Web projects use local IIS 8.5
I occasionally experience what I believe to be a VS bug where it converts some projects to use IISExpress (this is fixed by deleting the folder created in /This PC/Documents). This might be related.
You don't need to close Visual Studio or rename anything.
Open properties for %userprofile%\Documents
Select Security > Advanced, change owner to yourself (again if you are already owner).
Select "Replace owner on subcontainers and objects" and "Replace all child object permission entires with inherited permission entires from this object".
Ok.
For me, It's a simple lack of permission either give everyone permission
to "%userprofile%\Documents\IISExpress\config" this folder or Open VS in Admin mode
for me was removing the file Documents\IISExpress\config\applicationhost.config
Closing visual studio > Open > Debug
Thanks for the previous answer help go straight to the issue
After trying to solve an issue with a quick fix of changing IIS express inside visual studio from integrated to classic pipeline , I ended up not being able to use IIS express at all. I tried all techniques above...
I could not rename , copy the file. Uninstall of IIS express and re-install did not work.
I FINALLY downloaded the latest version of WebMatrix and installed IIS express 8, that did not work, but at least then i was able to finally delete the old directory and then I recreated itself.....
NOT FUN AT ALL.
I resolved this (with vs2013 and windows 7) by going to Documents > IISExpress> Config and renaming the application.config. After that, I restarted visual studio and opened my project and it worked.
I ran into this issue while trying to open another developer's solution after installing VS2013 (Update 3 RC). After following the advice here and deleting/renaming/etc. the config folder, VS re-created the files in the wrong location. It created nested config folders:
C:\Users[user]\Documents\IISExpress\config\config
I moved everything from ...\config\config into ...\config, and it worked as expected.
I found that deleting one of the sites from the applicationhost.config file resolve this problem for me.
I used the following command from the %ProgramFiles(x86)%\IISExpress directory:
appcmd list site
then
appcmd delete site rogueSiteName
Especially there was a site name with a bracketed number suffix (e.g. "MySite(1)") that I deleted. I'm not sure yet if VS2013 just had an issue with the brackets or that two sites pointed to the same directory. Either way deleting it made VS happy again.
Background
I had been struggling with this issue for a couple of days and nothing seemed to help - not even the instructions given in the top answers here.
I had also tried moving the config folder as mentioned in http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-80-express-readme. But although VS2013 recreated the directory structure and files in the new location the errors continued and running appcmd showed that it was still pointing at the old location by default.
Credits
Credit for where I found the commands to use goes to http://gyorgybalassy.wordpress.com/2013/12/02/cleaning-up-iis-express-configuration/
For ASP.Net Core just access your Properties section, then make a modification and save it.
Example: I modified the SSL port
You will get a notification that your launchsettings.json was modified. Accept that and you're good to go.
If it is ASP.NET Core project
Just try to change iis port in file launchSettings.json by path iisSettings:iisExpress:applicationUrl
It's 2020, I am reporting the same problem in Visual Studio 2019.
Cause: Multiple VS instances open with different web app (Blazor in my instance).
Solution: Close all VS instances and re-open the solution that you want to run.
On IIS 10 Express. Make sure that Visual Studio (VS) is turned off.
I first found out that %userprofile%\Documents\IISExpress\config\ was not working.
I first thought IIS Express had clashed with IIS from the windows OS.
I uninstalled it, yet no changes, then I uninstalled IIS 10 Express that was installed with VS 2019 through the control panel.
Then I went ahead to discover that this file is saved at the C:\Users\username\OneDrive\Documents\IISExpress, associated with one drive storage, so I advise you copy %userprofile%\Documents\IISExpress\config\ and paste in your windows explorer navigation to find directory.
go to one directory higher, and/or rename the config folder. Restart your VS and run the project again.
Mine was caused by OneDrive. Apparently my documents folder is being synced to it.
What I did is changed the location of the documents folder through regedit and navigated to this path:
HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Explorer > User Shell Folders
and then changed the value of Personal
from: C:\Users\my username\OneDrive\Documents
to C:\Users\my username\Documents
After that I restart my computer and I was able to create a VS project.
I have the same issue,
First time, i think Visual Studio not permission access to %userprofile%\Documents\IISExpress\config so i run Visual Studio with Administrator, but it not working.
I try all answer above but still the error!
Finally, i look internet, i see my onedrive is stopping, i enable and sync data. Restart computer and worked.

Opening a Visual Studio 2010 project in 2012 what creates the backup folder and how to control it?

I have an issue. We are upgrading to VS 2012 at work. When we open a VS 2010 project Visual Studio converts the project. This is fine, because VS 2010 can still use the project (yay microsoft). However, there is a \Backup folder created in the solution directory. Is this being created as part of the migration? Is there any way to control it?
The reason I ask is that the process that makes this folder copies web.config files into the folder. If you then try to build the solution (these are MVC projects), we get a "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." error. The cause is that there is a web.config file in a subfolder instead of the root folder. We did not make and do not want this change, and cannot figure out how to control it. Deleting the Backup\Web.config file fixes the error. Renaming it from web.config to web.config.bak fixes the problem.
I don't really want to have to personally open and convert every single project, and don't want random people bumping into this problem. Any idea how to either stop VS from creating the Backup folder, or how to make it create them in the my documents studio folder etc? I can't find any setting to control this and can't find any good info.
By chance, are you using the MvcBuildViews property to pre-compile your views at build time? If so, this is why you're encountering this (since it does the pre-compile in the same directory, it doesn't filter out any of the files below the project directory).
Note that you will also encounter this issue if you use the Publish feature for this project. Publish copies the web.config under your intermediate build output directory (by default, obj/) before and after applying web.config transforms.
The good news is that in VS2012, or in VS2010 with the latest Azure SDK installed, pre-compile is now supported for Web Application Projects (including MVC). These settings are currently in the project properties, under the Package/Publish Web tab.
(this doesn't directly address your question about the Backup folder, but it was too long for a comment.)
There is no way to control it that I found. We had to go ahead and run through and convert every project to 2012 and delete the backup folders to prevent any other team from running into it.

Why does it say "Project with that name already opened in the solution"?

I recently migrated a VSS database to TFS 2008. Using Source Control Explorer, I got the latest version of a solution with 12 projects.
When I opened the solution in VS 2005, two of the projects were not found. I am not sure why these two projects were not found, but thought it easiest to just delete and re-add them to the solution.
When I do this, VS gives me a "A project with that name is already open in the solution." The project doesn't appear in solution explorer, and is not listed in the .sln file.
Any ideas?
I had this problem and I was able to solve it using the following steps:
Remove the project from the solution.
restart visual studio.
add the project to the solution as an existing project.
I had the same message... Seems like it comes from (.csproj) project file. Under first propertygroup there is a section named
<ProjectTypeGuids>...</ProjectTypeGuids>
which generally tells Visual Studio to handle that project in some specific way. Some Guids can be found here.
First make a backup copy of that file. Then removing that section can help you open the project as usual project. As it seems that the Visual Studio thinks that the project is not the type that is specified in the ProjectTypeGuids.
This did it for me:
remove the section <ProjectTypeGuids>...</ProjectTypeGuids> in each project
reopen each project, then save to overwrite the existing project file, finally exit
reopen the solution file
pray (optional)
If anyone uses AnkhSVN instead of TFS, it's also possible, that the .sln-file need the following lines:
GlobalSection(SubversionScc) = preSolution
Svn-Managed = True
Manager = AnkhSVN - Subversion Support for Visual Studio
EndGlobalSection
in the "Global" section.
Before anyone tries tempering with their solution- and project files, figure if you may have project dependencies outside the solution, such as IIS - and you forgot to start Visual Studio in Administrator-mode
For me, the project not loaded was because it was configured to use IIS on the local machine and I needed to start Visual Studio as an Administrator.
I have to say that removing the section <ProjectTypeGuids>...</ProjectTypeGuids> could create some problems.
In fact, such a section defines the type of the project and, if removed, could disable some features.
For example, if your project was originally defined as Smart Device (C#), after removing the aforementioned section the on-device debug may not working properly.
Delete .suo file. Build solution. Add Projects.
Unfortunately I don't know the why behind the obtuse error message, I can merely provide what steps I took to get it to go away.
In my case, I had reconfigured my local IIS (<UseIIS> not <UseIISExpress>) and it was no longer hosting the URL that was in the csproj <IISUrl> field.
Editing the .csproj file in another editor and changing that field to the new URL, followed by closing and opening the solution in VS resolved the issue.
I would try hand editing the project/solution files, they are text and pretty easy to read. You can edit the file in notepad. To open up the file as text in visual studio you need to first close the solution. Then do file->open and select the sln file, but instead of hitting the open button, press on the right side where there is an arrow and select open with.. from there you can select source code editor (text).
Somehow VS 2022 doesn't create a virtual directory anymore. I had to manually create the website in IIS
I had the same problem when i migrated a website to a web app project.
Unload the web app.
Add the existing website.
Reload the web app.
The following worked for me when I moved a project running vs2010 to another laptop.
I removed exactly the following and it worked:
<ProjecctType>Guid of sorts</ProjectType>
<SccProjectName>Svn</SccProjectName>
<SccLocalPath>Svn</SccLocalPath>
<SccAuxPath>Svn</SccAuxPath>
<SccProvider>SubversionScc</SccProvider>
For those looking for this while dealing with VSTO projects...
Be sure to have the Office Tools for Visual Studio installed in your machine before opening the project.
I solved it by changing Windows' regional settings. Instead of "English (Europe)", I used "English (United States)". Others have reported similar behaviors with changing for example from "Russian (Ukraine)" to "Russian (Russia)", etc.
-AlessandroSegala
Work For me.
Ref: http://answers.microsoft.com/en-us/windows/forum/windows_10-windows_install/customized-cultures-cannot-be-passed-by-lcid-only/26eb9d4b-7ddb-4774-8a40-7a7d84ba9277?auth=1&rtAction=1455534187354
In my case it was corrupted vbproj file. First line was missing:
<?xml version="1.0" encoding="utf-8"?>
After adding this line I had to close the solution, delete .vs folder and open again.
I got it in Visual Studio 2022 version 17.4.4.
You may also see:
Error HRESULT E_FAIL has been returned from a call to a COM
component.
when you try to reload your project.
One way to load the project (and deal with IIS directories later) is to edit the .csproj file and set UseIISExpress to true.
Replace:
<UseIISExpress>false</UseIISExpress>
with
<UseIISExpress>true</UseIISExpress>
Then you need to close your solution and open it again and the project should load.
I encountered this issue with web application projects.
When I tried to reload the projects, the VS2022 output said something like :
"The project is configured to use IIS. Unable to find the server
'{site_url}' on the local computer. Ensure that the local IIS is
configured to handle secure communications."
Which is pretty clear. Indeed, in my case, this was caused by my website https binding that just vanished for no reason (it happened to me several times, looks like a bug with Windows 11 & IIS 10). Things got fixed when I got my https binding back (projects could load norammly).
In VS 2022 to open a legacy web project I had to:
Remove from Solution
Change framework version from 4.6.x to <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> in from csproj
Remove <OutputType>Library</OutputType> from csproj
Close Solution and open it again (!!!)
Add project to the sln again.

Resources