diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
index 047cb89316..d2d1dc8d8c 100644
--- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
+++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
@@ -2291,6 +2291,62 @@ public async Task MissingTargetsAreReported()
Assert.Equal(Path.Combine(temporaryDirectory.DirectoryPath, "this.file.does.not.exist.targets"), result.ErrorDetails!.ToString());
}
+ [Fact]
+ public async Task MissingVisualStudioComponentTargetsAreReportedAsMissingFiles()
+ {
+ using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
+ [
+ ("project.csproj", """
+
+
+
+
+ v4.5
+
+
+
+
+
+
+ packages\Some.Package.1.0.0\lib\net45\Some.Package.dll
+ True
+
+
+
+
+ """),
+ ("packages.config", """
+
+
+
+ """),
+ ("NuGet.Config", """
+
+
+
+
+
+
+ """)
+ ]
+ );
+ MockNuGetPackage[] packages =
+ [
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net45"),
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.1.0", "net45"),
+ ];
+ await MockNuGetPackagesInDirectory(packages, Path.Combine(temporaryDirectory.DirectoryPath, "packages"));
+ var resultOutputPath = Path.Combine(temporaryDirectory.DirectoryPath, "result.json");
+
+ var worker = new UpdaterWorker(new ExperimentsManager(), new TestLogger());
+ await worker.RunAsync(temporaryDirectory.DirectoryPath, "project.csproj", "Some.Package", "1.0.0", "1.1.0", isTransitive: false, resultOutputPath: resultOutputPath);
+
+ var resultContents = await File.ReadAllTextAsync(resultOutputPath);
+ var result = JsonSerializer.Deserialize(resultContents, UpdaterWorker.SerializerOptions)!;
+ Assert.Equal(ErrorType.MissingFile, result.ErrorType);
+ Assert.Equal("$(MSBuildExtensionsPath32)/Microsoft/VisualStudio/v$(VisualStudioVersion)/Some.Visual.Studio.Component.props", result.ErrorDetails!.ToString().NormalizePathToUnix());
+ }
+
[Fact]
public async Task ReportsPrivateSourceAuthenticationFailure()
{
diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs
index 32dc812dbf..411b892a12 100644
--- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs
+++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs
@@ -895,9 +895,13 @@ internal static void ThrowOnUnauthenticatedFeed(string stdout)
internal static string? GetMissingFile(string output)
{
- var missingFilePattern = new Regex(@"The imported project \""(?.*)\"" was not found");
- var match = missingFilePattern.Match(output);
- if (match.Success)
+ var missingFilePatterns = new[]
+ {
+ new Regex(@"The imported project \""(?.*)\"" was not found"),
+ new Regex(@"The imported file \""(?.*)\"" does not exist"),
+ };
+ var match = missingFilePatterns.Select(p => p.Match(output)).Where(m => m.Success).FirstOrDefault();
+ if (match is not null)
{
return match.Groups["FilePath"].Value;
}