Skip to content

Warn the user when building a project targeting 3.5 but the 3.5 SDK isn't installed #4384

@tmeschter

Description

@tmeschter

When building a project that targets the 2.0/3.0/3.5 Framework we try to use the tools defined by the $(SDK35ToolsPath) property:

https://github.com/microsoft/msbuild/blob/d42d3504057ef2b88dd4f68c4bfc5591371bd6fe/src/Tasks/Microsoft.NETFramework.CurrentVersion.props#L85

which we read from the registry. However, if the 3.5 development tools aren't installed then we won't find the value in the registry, $(SDK35ToolsPath) will not be defined, and we will silently "upgrade" to the 4.x tools instead:

https://github.com/microsoft/msbuild/blob/d42d3504057ef2b88dd4f68c4bfc5591371bd6fe/src/Tasks/Microsoft.NETFramework.CurrentVersion.props#L90

This can cause problems, such as using the wrong version of tlbimp to generate interop assemblies (which subsequently won't load at runtime).

We should instead detect and warn the user (or maybe even emit an error) when the 3.5 tools aren't installed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions