Пример #1
0
        static InteractiveDependencyResolver CreateDependencyResolver(
            AgentType agentType,
            IEnumerable <string> assemblySearchPaths)
        {
            var dependencyResolver = new InteractiveDependencyResolver(agentType: agentType);
            var consoleOrWpf       = agentType == AgentType.WPF || agentType == AgentType.Console;

            foreach (var strPath in assemblySearchPaths)
            {
                var path = new FilePath(strPath);
                if (path.DirectoryExists)
                {
                    Log.Info(TAG, $"Searching assembly path {path}");
                    dependencyResolver.AddAssemblySearchPath(
                        path,
                        scanRecursively: consoleOrWpf);

                    if (!consoleOrWpf)
                    {
                        path = path.Combine("Facades");
                        if (path.DirectoryExists)
                        {
                            dependencyResolver.AddAssemblySearchPath(path);
                        }
                    }
                }
                else
                {
                    Log.Warning(TAG, $"Assembly search path {strPath} does not exist");
                }
            }

            return(dependencyResolver);
        }
Пример #2
0
        static InteractiveDependencyResolver CreateDependencyResolver(
            TargetCompilationConfiguration configuration)
        {
            var dependencyResolver = new InteractiveDependencyResolver(configuration);
            var scanRecursively    = configuration.Sdk?.TargetFramework.Identifier == ".NETFramework";

            foreach (FilePath path in configuration.AssemblySearchPaths)
            {
                if (path.DirectoryExists)
                {
                    Log.Info(TAG, $"Searching assembly path {path} (recursive: {scanRecursively})");
                    dependencyResolver.AddAssemblySearchPath(
                        path,
                        scanRecursively);

                    if (!scanRecursively)
                    {
                        var facadesPath = path.Combine("Facades");
                        if (facadesPath.DirectoryExists)
                        {
                            Log.Info(TAG, $"Searching assembly path {facadesPath}");
                            dependencyResolver.AddAssemblySearchPath(facadesPath);
                        }
                    }
                }
                else
                {
                    Log.Warning(TAG, $"Assembly search path {path} does not exist");
                }
            }

            return(dependencyResolver);
        }