VS2010 “An item with the same key has already been added”

前端 未结 8 1349
慢半拍i
慢半拍i 2020-12-10 11:03

I recently installed Visual Studio 2010 and copied and converted an old VS2005 solution to VS2010

When I edit this solution, if I try to change a control\'s .image p

相关标签:
8条回答
  • 2020-12-10 11:26

    I worked this out thanks to a search. The solution is to never create a .resx file with the name "Resources.resx" because it conflicts with the "Resources.resx" files that can be automatically created in the project's properties dialog.

    Once I renamed Resources.resx to Icons.resx, I was able to change the image property for anything in the solution.

    0 讨论(0)
  • 2020-12-10 11:29

    Running VS2010, I was able to fix this error by resetting the environment:

    Tools > Import and Export Settings > Reset all settings
    
    0 讨论(0)
  • 2020-12-10 11:30

    Regarding Visual Studio 2015

    The problem I was having was I could not load a project or re-add it to ANY solution. I would get the same error reported by others which is

    Project '...' could not be opened because the Visual C# compiler could not
    be created. An item with the same key has already been added.
    

    This is going to sound overly simplistic, but when you get this error close ALL Visual Studio instances. Open the solution you were having trouble with and try again. This worked for me.

    0 讨论(0)
  • 2020-12-10 11:31

    *in vs2015 if you get "An item with the same key has already been added" like image bellowm delete iis configuration in your csproj file

    yours could be different but should be similar to following

     <ProjectExtensions>
        <VisualStudio>
          <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
            <WebProjectProperties>
              <UseIIS>True</UseIIS>
              <AutoAssignPort>True</AutoAssignPort>
              <DevelopmentServerPort>32049</DevelopmentServerPort>
              <DevelopmentServerVPath>/</DevelopmentServerVPath>
              <IISUrl>http://localhost:32049</IISUrl>
              <NTLMAuthentication>False</NTLMAuthentication>
              <UseCustomServer>False</UseCustomServer>
              <CustomServerUrl>
              </CustomServerUrl>
              <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
            </WebProjectProperties>
          </FlavorProperties>
        </VisualStudio>
      </ProjectExtensions>
    
    0 讨论(0)
  • 2020-12-10 11:33

    I just had this same problem, but I didn't have any "Resources.resx" file in my solution (I didn't have any *.resx files, for that matter). My problem came because my .vcxproj project file was trying to use a file twice. I had added a custom build step for my protobuf files and added all my *.proto files to my project. However, a rouge .proto file appeared twice. Getting rid of the duplicate solved the problem.

    So if you're having the same problem and you don't have any Resources.resx file, try looking at your .vcxproj file and making sure there aren't any other files that are getting duplicated.

    0 讨论(0)
  • 2020-12-10 11:37

    I had the same experience but due to duplicate image resources in the .csproj file:

    <Resource Include="Images\trigger-ModuleSelector1.png" />
    <Resource Include="Images\trigger-ModuleSelector2.png" />
    <Resource Include="Images\document.png" />
    <Resource Include="Images\folder.png" />
    <Resource Include="Images\trigger-ModuleSelector1.png" />
    <Resource Include="Images\trigger-ModuleSelector2.png" />
    

    Probably from a Merge Gone Wild(tm).

    Same symptoms--regular build OK, rebuild fails. Remove the duplicate resource entries to fix the problem.

    0 讨论(0)
提交回复
热议问题