Skip to content

Commit c0b50a6

Browse files
stan-szdfederm
andauthored
Add test coverage for amd64 MSBuild.exe (#69)
* Adapt * Update E2ETests.cs * Always use amd64 flavor of MSBuild.exe * Fix bad merge --------- Co-authored-by: David Federman <david.federman@outlook.com>
1 parent bd20381 commit c0b50a6

1 file changed

Lines changed: 2 additions & 38 deletions

File tree

src/Tests/E2ETests.cs

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ private static (string ExePath, string Verb) GetMsBuildExeAndVerb()
486486

487487
if (!string.IsNullOrEmpty(vsInstallDir))
488488
{
489-
string msbuildExePath = Path.Combine(vsInstallDir, @"MSBuild\Current\Bin\MSBuild.exe");
489+
string msbuildExePath = Path.Combine(vsInstallDir, @"MSBuild\Current\Bin\amd64\MSBuild.exe");
490490
if (!File.Exists(msbuildExePath))
491491
{
492492
throw new InvalidOperationException($"Could not find MSBuild.exe path for unit tests: {msbuildExePath}");
@@ -500,43 +500,7 @@ private static (string ExePath, string Verb) GetMsBuildExeAndVerb()
500500
return ("dotnet", "build");
501501
}
502502

503-
// From: https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
504-
private static void DirectoryCopy(string sourceDirName, string destDirName)
505-
{
506-
// Get the subdirectories for the specified directory.
507-
var dir = new DirectoryInfo(sourceDirName);
508-
509-
if (!dir.Exists)
510-
{
511-
throw new DirectoryNotFoundException($"Source directory does not exist or could not be found: {sourceDirName}");
512-
}
513-
514-
var subdirs = dir.GetDirectories();
515-
516-
// If the destination directory doesn't exist, create it.
517-
if (!Directory.Exists(destDirName))
518-
{
519-
Directory.CreateDirectory(destDirName);
520-
}
521-
522-
// Get the files in the directory and copy them to the new location.
523-
var files = dir.GetFiles();
524-
foreach (var file in files)
525-
{
526-
var destFile = Path.Combine(destDirName, file.Name);
527-
file.CopyTo(destFile, false);
528-
}
529-
530-
// Copy subdirectories and their contents to new location.
531-
foreach (var subdir in subdirs)
532-
{
533-
var destSubdirName = Path.Combine(destDirName, subdir.Name);
534-
DirectoryCopy(subdir.FullName, destSubdirName);
535-
}
536-
}
537-
538-
private async Task RunMSBuildAsync(string projectFile, Warning[] expectedWarnings, string[]? expectedConsoleOutputs = null, bool expectUnusedMsvcLibrariesLog = false,
539-
bool enableReferenceTrimmerDiagnostics = false)
503+
private async Task RunMSBuildAsync(string projectFile, Warning[] expectedWarnings, string[]? expectedConsoleOutputs = null, bool expectUnusedMsvcLibrariesLog = false, bool enableReferenceTrimmerDiagnostics = false)
540504
{
541505
var testDataSourcePath = Path.GetFullPath(Path.Combine("TestData", TestContext?.TestName ?? string.Empty));
542506

0 commit comments

Comments
 (0)