如何在Visual Studio 2010中将现有c#资源设置为默认资源?

时间:2012-10-28 11:34:21

标签: c# visual-studio-2010

我已经导入了一个项目,但是当我导入它时,该项目已由visual studio 2010转换。

我的麻烦是VS没有识别资源文件,而是将其翻译为默认资源文件。

其中一个后果是,当我添加新语言时,VS不会将资源添加为卫星...

如何再次将资源文件设置为默认资源?

到目前为止,我手动编辑Csproj以添加我的本地化资源文件。

谢谢!

2 个答案:

答案 0 :(得分:0)

卸载csproj并以这种方式编辑每种语言的xml:

<Compile Include="Resources\Resource.Designer.cs">
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
  <DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Resource.en-US.Designer.cs">
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
  <DependentUpon>Resource.en-US.resx</DependentUpon>
</Compile>

请注意,我已将所有资源文件移动到Resource文件夹中,如果不是这种情况,请从xml中删除Resources\。对于每个resx,您还应将access modifier设置为public

答案 1 :(得分:0)

尝试删除资源文件。然后右键单击您的项目,选择Add an existing item并选择.resx文件。可能会有用。