我有一个我已经复制到另一个项目的strings.resx文件。它有一个关联的strings.designer.cs文件。问题是,一旦我将它们添加到VS.NET项目中,它们就是分开的。
在旧项目中,strings.designer.cs是strings.resx的子代。如果我双击strings.resx,它会自动生成一个strings1.designer.cs文件。
如何重新创建关联?
答案 0 :(得分:1)
我可以重现你的问题。
如果查看.csproj文件,在新项目中导入资源后,您可以找到包含ItemGroup
项的<Compile Include="string.Designer.cs" />
部分,类似于以下内容
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
....
<Compile Include="string.Designer.cs" />
</ItemGroup>
所以要解决您的问题,请执行以下操作
<Compile Include="string.Designer.cs" />
<Compile Include="string.Designer.cs" />
通过
<Compile Include="string.Designer.cs"> <DependentUpon>string.resx</DependentUpon> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> </Compile>
现在重新加载项目广告,您应该会在解决方案资源管理器上看到您的文件相关