Reputation: 1775
I changed my ASP.NET web application to use Local IIS, instead of IIS Express. Now after re-opening the solution, the following error occurs while loading the application:
error : Project 'Atlas2' could not be opened because the Visual C# 2015 compiler could not be created. 'Atlas2' is already part of the workspace.
error : Project 'Atlas2' could not be opened because the Visual C# 2015 compiler could not be created. An item with the same key has already been added.
Would someone please help me how I can reload the project? I'm using Visual Studio Team Services (was TFS Online), if it helps.
Upvotes: 24
Views: 25796
Reputation: 65544
I created a new Sln file.
Close the Solution.
Open the Project file of the main project. Add the offending projects back to the new Sln file.
Save the Sln file over the top of the old faulty one.
Upvotes: 0
Reputation: 1
I had this issue with an upgrade for Visual Studio 2017. It has been fixed and is now available in an updated release.
You can download the latest update via the in-product notification or from https://www.visualstudio.com
Ref: Project could not be opened because the Visual C# 2017 compiler could not be created
Upvotes: 0
Reputation: 4358
I was facing similar issue but none of the mentioned solutions worked for me.
However, I was opening my solution from within visual studio recent solutions list. But when I opened the solution file from explorer by double clicking on it, the project loaded correctly.
Upvotes: 4
Reputation: 2931
I had the same exact error, this is what solved my issue. In the root of your solution you should see a .vs/config/applicationhost.config. In this folder delete the offending site. Mine looked like this:
<site name="FrontEnd.Web" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\xxxxx\xxxxx\xxxxx\FrontEnd.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:3391:localhost" />
</bindings>
</site>
I deleted the entire site tag for this application, saved and then, right-clicked my solution > Add > Existing Project and re-added the project to the solution.
Upvotes: -1
Reputation: 475
The problem is the app has been configured to use local IIS instead of Express and their coud be two issues for which you are unable to load the app.
Issue 1. You don't have IIS installed in your local system, In this case you have to install IIS or have to open the .csproj file and do the changes:
<UseIISExpress>false</UseIISExpress> to true
Remove <UseIIS>True</UseIIS>
Remove <IISUrl>http://localhost</IISUrl>
Issue 2. Visual studio doesn't have access to IIS, in this case just open the Visual studio in administrator mode.
Upvotes: 4
Reputation: 63
I had the same problem when I moved my WCF REST service from IISExpress to localhost. So, what I did was I opened the .csproj file in Notepad and looked for UseIISExpress, changed its value from false to True. Then opened VS2015 as administrator and it worked. The good thing is that when I run the project it is still running on my localhost not IISExpress.
Upvotes: 0
Reputation: 367
I had this error after switching from IIS Express to full IIS with Visual Studio 2015. I was able to load the project when I ran Visual Studio as Administrator.
Upvotes: 6
Reputation: 5860
I was getting a similar error in VS 2015.
"could not be opened because the visual c# 2015 compiler could not be created." "with the same key has already been added"
I was able to workaround the issue by opening the solution in Visual Studio 2013, Cleaning the solution, closing visual studio, then opening the same solution in Visual Studio 2015.
I also noticed that after doing this sequence of events, the csproj file of the project that was initially giving this error updated its ProjectExtensions element and set <UseIIS>False</UseIIS>
Image below of diff between csproj when error was occuring and after workaround.
Keep in mind that before I used this workaround, I tried to update that element manually and set to false, but that did not work.
Upvotes: 4
Reputation: 27852
I was getting this error.
I am using IIS-Express. And I have VS2015.
After messing around with the .csproj file....I was able to get it to work.
After comparing my current file to what was in TFS source control, the only difference was this line.
Previously, this line did not exist. In my "working" (after messin' with it) file, I had
<UseGlobalApplicationHostFile />
Again, in the csproj that causes the error, I didn't have the magic line, but in the working csproj, I had it.
Below is the above line, in context. Only use the below for breadcrumbs, do not copy/paste all of it. The magic line is 3 from the bottom.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}</ProjectGuid>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyRootNamespace</RootNamespace>
<AssemblyName>MyAssemblyName</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Upvotes: 0
Reputation: 2187
The same problem occurred at my system and got solved by running The Visual Studio in administrator mode. The issue was IIS having the same host+port name as ASP.NET project and without administrator rights Visual Studio was not able add the website.
Upvotes: 26
Reputation: 1775
I solved my problem. I unloaded the project and edited .csproj file. I did the following changes:
<UseIISExpress>false</UseIISExpress>
to true<UseIIS>True</UseIIS>
<IISUrl>http://localhost/MyWebApp</IISUrl>
Then I reloaded the project. It worked. Actually it rolled back to use IIS Express.
Upvotes: 35
Reputation: 4700
This often happens when authentication has not been setup in IIS or the website (or virtual directory) has not been setup in IIS. To fix this problem, open IIS manager.
This should open up the website so Visual Studio can load your project. If not, go to Advanced Settings for you site and select Physical Path Credentials. Make sure that's set to pass-through authentication.
Upvotes: 2