Build .net 3.5 resources.dll for a .net 3.5 program using VS2015

768 Views Asked by At

I have a project that targets .NET 3.5.

This happened after I reinstalled Windows 10, Visual Studio 2015 and Visual Studio 2017.
Now I can no longer build the project correctly.

The project build and run successfully without any warnings but the localized resources are not targeting the correct .NET version. The main assembly containing the neutral resources is correctly built as a .NET 3.5 assembly but all asseblies with resources in other locales are generated as .NET 4.0 assemblies.

My guess is that I'm missing some SDK that VS2015 used before to generate the localized resources. Since the reinstall I have not yet installed it. I've tried to find and install SDK:s for .NET 3.5. Those I found was for Server 2008 but after installing it nothing apeared to change.

I have Windows SDKs installed for v10.0A, v8.1A, v7.0A, v7.0 and v6.1. I guess v6.1 would be able to target .NET 3.5 but I'm not sure how to tell VS2015 to use it.

1

There are 1 best solutions below

0
On

Update: and the circle is completed

If you get an error that says.

WinSDK 7.0 (Windows SDK for Windows 7 and .NET Framework 3.5 SP1) is not installed, and it is required because WinSDK 8.0 or higher doesn't provide .NET 3.5 tools.

The paths might have changed slightly generating the error in error.

Start by removing the <Target... below and try recompiling first before going further.

Original answer

According to this solution a bug in VS2017 that clears the registry key that would set $(SDK35ToolsPath) and when it's clear the fallback is the 4.0 version.

The following comes from the linked solution. Note that editing the registry did not affect the results until after some time had passed. Simply restarting VS2015 did not

Update the Windows registry:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86\InstallationFolder
= c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0\bin

It's also suggested to catch this bug earlier by adding the following to your .csproj file.

<Target Name="CheckVariables" BeforeTargets="_CheckForInvalidConfigurationAndPlatform">
  <PropertyGroup>
    <WinSDK-70-NetFx35Tools-InstallationFolder>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v7.0\WinSDKNetFx35Tools@InstallationFolder)</WinSDK-70-NetFx35Tools-InstallationFolder>
    <WinSDK-80A-NetFx35Tools-x86-InstallationFolder>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86@InstallationFolder)</WinSDK-80A-NetFx35Tools-x86-InstallationFolder>
  </PropertyGroup>
  <Message Importance="high" Text="MSBuildToolsPath: $(MSBuildToolsPath)" />
  <Message Importance="high" Text="MSBuildToolsVersion: $(MSBuildToolsVersion)" />
  <Message Importance="high" Text="WinSDK-70-NetFx35Tools-InstallationFolder: $(WinSDK-70-NetFx35Tools-InstallationFolder)" />
  <Message Importance="high" Text="WinSDK-80A-NetFx35Tools-x86-InstallationFolder: $(WinSDK-80A-NetFx35Tools-x86-InstallationFolder)" />
  <Message Importance="high" Text="SDK35ToolsPath: $(SDK35ToolsPath)" />
  <Message Importance="high" Text="SDK40ToolsPath: $(SDK40ToolsPath)" />
  <Error Condition="$(WinSDK-70-NetFx35Tools-InstallationFolder)==''" Text="WinSDK 7.0 (Windows SDK for Windows 7 and .NET Framework 3.5 SP1) is not installed, and it is required because WinSDK 8.0 or higher doesn't provide .NET 3.5 tools." />
  <Error Condition="$(WinSDK-80A-NetFx35Tools-x86-InstallationFolder)==''" Text="HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86@InstallationFolder is blank. Edit it to point to $(WinSDK-70-NetFx35Tools-InstallationFolder)" />
  <Error Condition="$(SDK35ToolsPath)==''" Text="SDK35ToolsPath not set. Maybe HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx35Tools-x86@InstallationFolder is blank." />
</Target>