Beispiel #1
0
        public string ChangeWorkingDirectory()
        {
            var currentWorkingDirectory = Directory.GetCurrentDirectory();

            if (!string.IsNullOrEmpty(WorkingDirectory))
            {
                Directory.SetCurrentDirectory(WorkingDirectory);
            }
            else if (!string.IsNullOrEmpty(Project))
            {
                var workingDirectory = Path.GetDirectoryName(Project);
                if (Directory.Exists(workingDirectory))
                {
                    Directory.SetCurrentDirectory(workingDirectory);
                }
            }
            else if (AssemblyPaths.Any())
            {
                var workingDirectory = Path.GetDirectoryName(AssemblyPaths.First());
                if (Directory.Exists(workingDirectory))
                {
                    Directory.SetCurrentDirectory(workingDirectory);
                }
            }

            return(currentWorkingDirectory);
        }
Beispiel #2
0
        protected async Task <TResult> RunIsolatedAsync(string configurationFile)
        {
            var assemblyDirectory = AssemblyPaths.Any() ? Path.GetDirectoryName(Path.GetFullPath(PathUtilities.ExpandFileWildcards(AssemblyPaths).First())) : configurationFile;
            var bindingRedirects  = GetBindingRedirects();
            var assemblies        = GetAssemblies(assemblyDirectory);

            using (var isolated = new AppDomainIsolation <IsolatedCommandAssemblyLoader <TResult> >(assemblyDirectory, AssemblyConfig, bindingRedirects, assemblies))
            {
                return(await Task.Run(() => isolated.Object.Run(GetType().FullName, JsonConvert.SerializeObject(this), AssemblyPaths, ReferencePaths)).ConfigureAwait(false));
            }
        }
Beispiel #3
0
        protected Task <TResult> RunIsolatedAsync(string configurationFile)
        {
            var assemblyDirectory = AssemblyPaths.Any() ? Path.GetDirectoryName(Path.GetFullPath(PathUtilities.ExpandFileWildcards(AssemblyPaths).First())) : configurationFile;
            var bindingRedirects  = GetBindingRedirects();
            var assemblies        = GetAssemblies(assemblyDirectory);

            if (UseNuGetCache)
            {
                var defaultNugetPackages = LoadDefaultNugetCache();
                ReferencePaths = ReferencePaths.Concat(defaultNugetPackages).ToArray();
            }

            using (var isolated = new AppDomainIsolation <IsolatedCommandAssemblyLoader>(assemblyDirectory, AssemblyConfig, bindingRedirects, assemblies))
            {
                return(Task.FromResult(isolated.Object.Run(GetType().FullName, JsonConvert.SerializeObject(this), AssemblyPaths, ReferencePaths)));
            }
        }