Source/Fuse/Tests/Solution/SolutionTestsHelper.cs
/// <summary>
/// Finds the physical path to the Visual Studio Solution File of the <paramref name="assembly"/>.
/// </summary>
/// <param name="assembly">The assembly of which to find the physical Visual Studio Solution File path to.</param>
/// <returns>
/// The physical path to the Visual Studio Solution File of the <paramref name="assembly"/>.
/// </returns>
Finds the physical path to the Visual Studio Solution File of the .
Finds the physical path to the Visual Studio Solution File of the .
public static string FindSolutionPathOf(Assembly assembly)
        {
			var assemblyPath = assembly.GetPhysicalLocation();
			if (String.IsNullOrEmpty(assemblyPath))
			{
				throw new FileNotFoundException($"Could not find a physical path for '{assembly}'.");
			}
			FileInfo assemblyFile = new FileInfo(assemblyPath);
			DirectoryInfo parentDirectory = assemblyFile.Directory;
            string fileNotFoundMessage = $"Couldn't find a Solution file for '{assembly}'.";
            try
            {
                while ((parentDirectory = parentDirectory.Parent) != null)
                {
                    FileInfo[] solutionFiles = parentDirectory.GetFiles("*.sln");
                    if (solutionFiles.Length > 0)
                        return solutionFiles[0].FullName;
                }
            }
            catch (Exception exception)
            {
                throw new FileNotFoundException(fileNotFoundMessage, exception);
            }
            throw new FileNotFoundException(fileNotFoundMessage);
        }
public static string FindSolutionPathOf ( Assembly assembly ) { var assemblyPath = assembly . GetPhysicalLocation ( ) ; if ( String . IsNullOrEmpty ( assemblyPath ) ) { throw new FileNotFoundException ( $" Could not find a physical path for ' { assembly } '. " ) ; } FileInfo assemblyFile = new FileInfo ( assemblyPath ) ; DirectoryInfo parentDirectory = assemblyFile . Directory ; string fileNotFoundMessage = $" Couldn't find a Solution file for ' { assembly } '. " ; try { while ( ( parentDirectory = parentDirectory . Parent ) != null ) { FileInfo [ ] solutionFiles = parentDirectory . GetFiles ( " " ) ; if ( solutionFiles . Length > 0 ) return solutionFiles [ 0 ] . FullName ; } } catch ( Exception exception ) { throw new FileNotFoundException ( fileNotFoundMessage , exception ) ; } throw new FileNotFoundException ( fileNotFoundMessage ) ; }
Finds the physical path to the Visual Studio Solution File of the .
Finds the physical path to the Visual Studio Solution File of the .
The physical path to the Visual Studio Solution File of the .
The physical path to the Visual Studio Solution File of the .
assembly
Assembly
The assembly of which to find the physical Visual Studio Solution File path to.
The assembly of which to find the physical Visual Studio Solution File path to .