How to determine the folders used by a Microsoft Visual Studio unit test

You can use the directories used by a Microsoft Visual Studio unit test, by using the TestContext object. [TestMethod] public void GetUnittestFolders() { Console.WriteLine(string.Format("CurrentTestOutcome [{0}]", TestContext.CurrentTestOutcome)); Console.WriteLine(string.Format("DeploymentDirectory [{0}]", TestContext.DeploymentDirectory)); Console.WriteLine(string.Format("ResultsDirectory [{0}]", TestContext.ResultsDirectory)); Console.WriteLine(string.Format("TestDeploymentDir [{0}]", TestContext.TestDeploymentDir)); Console.WriteLine(string.Format("TestDir [{0}]", TestContext.TestDir)); Console.WriteLine(string.Format("TestLogsDir [{0}]", TestContext.TestLogsDir)); Console.WriteLine(string.Format("TestRunDirectory [{0}]", TestContext.TestRunDirectory)); Console.WriteLine(string.Format("TestRunResultsDirectory [{0}]", TestContext.TestRunResultsDirectory)); }     …

Cleaning a Microsoft Visual Studio solution after setting all files to read-only

Making ".\bin", ".\Release", ".\Debug", ".\obj" not read-only, after accidentally setting the root folder of you’re Microsoft Visual Studio solution to "read-only". You can use this script:     string sourceFolder = @"C:\Projects"; foreach (string folder in Directory.GetDirectories(sourceFolder, "*", SearchOption.AllDirectories)) { if (folder.EndsWith(@"\obj") || folder.EndsWith(@"\bin") || folder.EndsWith(@"\Release") || folder.EndsWith(@"\Debug"))     {       DirectoryInfo …