Reputation: 186
I have a problem with retrieving the right translation file (.resx) based on a CultureInfo object. So I have a translation solution which has four .resx files (the Italian translations of the application, the Dutch, the German, and the English):
In my application I reference the Qit.WindowsStrings dll and then I can use the translations in my application like this:
lblAddress1.Text = Qit.WindowsStrings.WinStrings.Address1;
The problem is though that I always retrieve the default .resx file so the translation are always English.
The reason for this is that some dll's (in the Qit.WindowsStringsSolutions) are build with a higher .NET framework then the project target framework and this is causing this error message in the application (which targets: .NET framework 3.5) that uses these translation assemblies:
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I have analyzed the dll's in the Qit.WindowsStringsSolution with DotPeek:
.. and it turned out that some dll's are build with .NET target framework 4.0 (exactly those .resx translation dll files that don't work).
The project itself (where these .resx files are part of ) is build against .NET framework 3.5. Does anybody know how this is possible and how I should solve this?
Maybe I should delete the winstrings.de.resx etc files and recreate them and then build the project again?
Ralf; the project file (.csproj) of the Qit.WindowsStrings project is as followed:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{005BF8BB-23CE-402A-BB2D-CC1AE9CC326B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Qit.WindowsStrings</RootNamespace>
<AssemblyName>Qit.WindowsStrings</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>qit.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Utils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WinStrings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>WinStrings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WinStrings.de.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="WinStrings.it.resx" />
<EmbeddedResource Include="WinStrings.nl.resx" />
<EmbeddedResource Include="WinStrings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>WinStrings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="qit.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Do you see something unusual?
Upvotes: 0
Views: 66