Skip to content

Emit an actionable error when Microsoft.WebApplication.targets / WebApplicationsTargetPath cannot be resolved #106

Description

@ehasis

Split out from #103 (item 2).

Summary

When WebApplicationsTargetPath resolves to a path that does not exist (the common case under dotnet, where $(MSBuildExtensionsPath32) points at the .NET SDK instead of a Visual Studio install), the build fails with a cryptic, low-level error:

error MSB4019: The imported project "...\dotnet\sdk\x.y.z\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" was not found.

Proposed change

Make the Microsoft.WebApplication.targets import conditional on Exists('$(WebApplicationsTargetPath)') and add an early target that emits a clear, actionable error (e.g. SYSWEB001) explaining how to fix it: install the Visual Studio / Build Tools "web development build tools" workload, build from a Visual Studio Developer command prompt, or set VSToolsPath / WebApplicationsTargetPath explicitly (e.g. computed via VSWhere in a CI pre-build step).

Note

This is intended as interim, in-SDK guidance. If Microsoft.WebApplication.targets becomes available as a separately packaged/released component from Microsoft (cc @twsouthwick), that would likely be the better long-term source and this could defer to it. See #104.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions