Skip to content

Commit

Permalink
Add VCTargetsPath to VerifyVSDistributionPath (#10554)
Browse files Browse the repository at this point in the history
This changes the experience for trying to `dotnet msbuild` vcxproj from

```
ConsoleApplication3.vcxproj(28,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
```

to

```
ConsoleApplication3.vcxproj(28,3): error MSB4278: The imported file "$(VCTargetsPath)\Microsoft.Cpp.Default.props" does not exist and appears to be part of a Visual Studio component. This file may require MSBuild.exe in order to be imported successfully, and so may fail to build in the dotnet CLI.
```
  • Loading branch information
rainersigwald authored Aug 23, 2024
1 parent 040956f commit 9b15d8b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Build/Evaluation/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2579,7 +2579,8 @@ private void SetAllProjectsProperty()
private void VerifyVSDistributionPath(string path, ElementLocation importLocationInProject)
{
if (path.IndexOf("Microsoft\\VisualStudio", StringComparison.OrdinalIgnoreCase) >= 0
|| path.IndexOf("Microsoft/VisualStudio", StringComparison.OrdinalIgnoreCase) >= 0)
|| path.IndexOf("Microsoft/VisualStudio", StringComparison.OrdinalIgnoreCase) >= 0
|| path.IndexOf("$(VCTargetsPath)", StringComparison.OrdinalIgnoreCase) >= 0)
{
ProjectErrorUtilities.ThrowInvalidProject(importLocationInProject, "ImportedProjectFromVSDistribution", path);
}
Expand Down

0 comments on commit 9b15d8b

Please sign in to comment.