public void LoadNonExistingAssembly() { using (var dir = new FileUtilities.TempWorkingDirectory(ProjectFileFolder)) { string projectFilePath = Path.Combine(dir.Path, ProjectFileName); string dllName = "NonExistent.dll"; bool successfulExit; string output = RunnerUtilities.ExecMSBuild(projectFilePath + " /v:diag /p:AssemblyPath=" + dllName, out successfulExit); Assert.False(successfulExit); string dllPath = Path.Combine(BuildEnvironmentHelper.Instance.CurrentMSBuildToolsDirectory, dllName); CheckIfCorrectAssemblyLoaded(output, dllPath, false); } }
public void LoadAssemblyAndDependency_OutsideProjectFolder() { using (var dir = new FileUtilities.TempWorkingDirectory(ProjectFileFolder)) { string projectFilePath = Path.Combine(dir.Path, ProjectFileName); string tempDir = MoveOrCopyDllsToTempDir(dir.Path, copy: false); var newTaskDllPath = Path.Combine(tempDir, TaskDllFileName); bool successfulExit; string output = RunnerUtilities.ExecMSBuild(projectFilePath + " /v:diag /p:AssemblyPath=" + newTaskDllPath, out successfulExit); successfulExit.ShouldBeTrue(output); CheckIfCorrectAssemblyLoaded(output, newTaskDllPath); } }
public void LoadInsideAssemblyWhenGivenOutsideAssemblyWithSameName() { using (var dir = new FileUtilities.TempWorkingDirectory(ProjectFileFolder)) { string projectFilePath = Path.Combine(dir.Path, ProjectFileName); string originalDLLPath = Path.Combine(dir.Path, DLLFileName); string copiedDllPath = MoveOrCopyDllToTempDir(originalDLLPath, copy: true); try { bool successfulExit; string output = RunnerUtilities.ExecMSBuild(projectFilePath + " /v:diag /p:AssemblyPath=" + copiedDllPath, out successfulExit); Assert.True(successfulExit); CheckIfCorrectAssemblyLoaded(output, originalDLLPath); } finally { UndoDLLOperations(copiedDllPath); } } }