Reputation: 44310
I have a strings.resx file that I've copied to another project. It has an associated strings.designer.cs file. The problem is that once I add them to the VS.NET project, they are separate.
In the older project, strings.designer.cs is a child of strings.resx. If I double click strings.resx, it auto generates a strings1.designer.cs file.
How do I recreate the association?
Upvotes: 1
Views: 729
Reputation: 6981
I could reproduce your issue.
After importing the resource in the new project if you look at the .csproj file you could find an ItemGroup
section containing the <Compile Include="string.Designer.cs" />
item, similar to the following
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
....
<Compile Include="string.Designer.cs" />
</ItemGroup>
So to solve your issue do the following
<Compile Include="string.Designer.cs" />
<Compile Include="string.Designer.cs" />
by
<Compile Include="string.Designer.cs"> <DependentUpon>string.resx</DependentUpon> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> </Compile>
Now reload the project ad you should see your files related on the solution explorer
Upvotes: 1