I would like to bring this topic back, as I have the same problem and the solution of bozydar.sz (uninstalling .NET 4.5) doesn't seem acceptable to me. I found the same problem with Visual Studio 2012 (Express, Desktop) when targeting my Windows Forms application to .NET 3.5 framework. I inspected the resource DLLs with ildasm
and found the resource DLLs were built with 4.0 runtime even the target framework was 3.5.
The same issue using VS2012 Express has been reported at Microsoft Dev Center, however a solution is not reported. In another post on Stackoverflow, the problem was also reported for VS2012 and target framework < 4.0. The solution for the questioner was to stay with the previous version of Visual Studio, which again isn't very much of a solution.
I tried different settings for "Build Action" and other properties of the *.resx files, without success.
Next, I verified this problem as follows: I installed Windows SDK for Windows 7 and .NET 3.5 SP1. From the command prompt of that Windows SDK 7.0, I've built the Visual Studio 2012 sln file with msbuild 3.5. Inspecting the resource DLLs with ildasm
gives me version 2.0.50727 this time, this is what I would expect here. When I replace the resource DLLs of the original deployment (from VS2012 publish dialog with target framework 3.5 and ToolsVersion 4.0) by the resource DLLs which I got from msbuild 3.5 in my deployment, the problem is resolved: Localization of the Windows Forms application is correct now. But still, using msbuild 3.5 is not a long term solution. If target framework 3.5 is offered in VS2012, I would expect this to behave properly.
With Visual Studio 2013 RC the same behavior was observed: the resource DLLs have version 4.0 and not 2.0. The resource DLLs cannot be loaded by the main application.
This answer by user Dan Malcom to another question on Stackoverflow led me to a registry hack that works for me:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0]
"MSBuildToolsPath"="c:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\"
"MSBuildToolsRoot"="c:\\Windows\\Microsoft.NET\\Framework64\\"
"FrameworkSDKRoot"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A@InstallationFolder)"
"MSBuildRuntimeVersion"="4.0.30319"
"SDK40ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A\\WinSDK-NetFx40Tools-x86@InstallationFolder)"
"SDK35ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0\\WinSDKNetFx35Tools@InstallationFolder)"
"MSBuildToolsPath32"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\MSBuild\\ToolsVersions\\4.0@MSBuildToolsPath)"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0\11.0]
"FrameworkSDKRoot"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A@InstallationFolder)"
"SDK40ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A\\WinSDK-NetFx40Tools-x86@InstallationFolder)"
"SDK35ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0\\WinSDKNetFx35Tools@InstallationFolder)"
"WindowsSDK80Path"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0@InstallationFolder)"
The original keys in my registry were:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0]
"MSBuildToolsPath"="c:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\"
"MSBuildToolsRoot"="c:\\Windows\\Microsoft.NET\\Framework64\\"
"FrameworkSDKRoot"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0A@InstallationFolder)"
"MSBuildRuntimeVersion"="4.0.30319"
"SDK40ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0A\\WinSDK-NetFx40Tools-x86@InstallationFolder)"
"SDK35ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0A\\WinSDK-NetFx35Tools-x86@InstallationFolder)"
"MSBuildToolsPath32"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\MSBuild\\ToolsVersions\\4.0@MSBuildToolsPath)"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0\11.0]
"FrameworkSDKRoot"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A@InstallationFolder)"
"SDK40ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A\\WinSDK-NetFx40Tools-x86@InstallationFolder)"
"SDK35ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0A\\WinSDK-NetFx35Tools-x86@InstallationFolder)"
"WindowsSDK80Path"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0@InstallationFolder)"
I exported the registry keys, edited them end ran the file to correct the keys. For the Wow6432Node
of the registry I did the same.
The following problems existed in my original registry (must be the state after I installed VS2012 and Windows SDK 7.0):
- The
FrameworkSDKRoot
value in the ToolsVersions\4.0
key references a key from Windows SDK 7.0A (the one that comes with VS2010), but this version was never installed on my machine.
- The same holds for the
SDK40ToolsPath
and SDK35ToolsPath
values.
- The
SDK35ToolsPath
value in the ToolsVersions\4.0\11.0
key references a WinSDK-NetFx35Tools-x86
which did not exist.
- In the
Wow6432Node
, all of the FrameworkSDKRoot
, SDK35ToolsPath
or SDK40ToolsPath
were incorrect (referencing non-existing registry values).
Editing the registry resolves the problem, but at high cost: One needs to apply this change to every development computer / build server.