Solution: The item "properties\AppResources.Designer.cs" was specified more than onc

Topics: Developer Forum
Apr 8, 2012 at 12:16 PM

Once I started modifying SLK source, I faced weird problem with AppResources. I'm sure everyone does who use VS2010 or VS2008.

Problem was: I add new string resource to AppResources.resx file and immediately receive compilation error:

The item "LearningStore\LearningStoreStrings.Designer.cs" was specified more than once in the "Sources" parameter.  Duplicate items are not supported by the "Sources" parameter.

Damn. WTF happened?! I say: you used VS to open AppResources.resx file to edit it. The VisualStudio then modified SlkDLL.csproj file itself, and after that you get compilation error.

How to get rid of this error: open file SlkDll.csproj in any text editor. Find following part:

    <Compile Include="Properties\AppResources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>AppResources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\SlkFrameset.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>SlkFrameset.resx</DependentUpon>
    </Compile>

The <Compile Include="Properties\AppResources.Designer.cs"> is thing we're looking for. Now do the following - COMMENT this out, so you get this:

    <!--
    <Compile Include="Properties\AppResources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>AppResources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\SlkFrameset.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>SlkFrameset.resx</DependentUpon>
    </Compile>
    -->

This is how it's made in original SlkDLL.csproj you've downloaded.

Last and important: search over SlkDLL.csproj file to ensure you don't have any other occurrences of
<Compile Include="Properties\AppResources.Designer.cs"> - if you have - delete them.

 

How to avoid this error in future: DO NOT USE Visual Studio to modify AppResources.resx - use Notepad or whatever to make changes in .resx, but not VS.

 

Hope that helps to save hours (or days) of your life :)