public CommandSpec Resolve(CommandResolverArguments commandResolverArguments)
        {
            var publishDirectory = commandResolverArguments.OutputPath;
            var commandName      = commandResolverArguments.CommandName;
            var applicationName  = commandResolverArguments.ApplicationName;

            if (publishDirectory == null || commandName == null || applicationName == null)
            {
                return(null);
            }

            var commandPath = ResolveCommandPath(publishDirectory, commandName);

            if (commandPath == null)
            {
                return(null);
            }

            var depsFilePath = Path.Combine(publishDirectory, $"{applicationName}.deps.json");

            if (!File.Exists(depsFilePath))
            {
                Reporter.Verbose.WriteLine(string.Format(
                                               LocalizableStrings.DoesNotExist,
                                               PublishedPathCommandResolverName,
                                               depsFilePath));
                return(null);
            }

            var runtimeConfigPath = Path.Combine(publishDirectory, $"{applicationName}.runtimeconfig.json");

            if (!File.Exists(runtimeConfigPath))
            {
                Reporter.Verbose.WriteLine(string.Format(
                                               LocalizableStrings.DoesNotExist,
                                               PublishedPathCommandResolverName,
                                               runtimeConfigPath));
                return(null);
            }

            return(_commandSpecFactory.CreateCommandSpecFromPublishFolder(
                       commandPath,
                       commandResolverArguments.CommandArguments.OrEmptyIfNull(),
                       CommandResolutionStrategy.OutputPath,
                       depsFilePath,
                       runtimeConfigPath));
        }
Beispiel #2
0
        public CommandSpec Resolve(CommandResolverArguments commandResolverArguments)
        {
            var publishDirectory = commandResolverArguments.OutputPath;
            var commandName      = commandResolverArguments.CommandName;
            var applicationName  = commandResolverArguments.ApplicationName;

            if (publishDirectory == null || commandName == null || applicationName == null)
            {
                return(null);
            }

            var commandPath = ResolveCommandPath(publishDirectory, commandName);

            if (commandPath == null)
            {
                return(null);
            }

            var depsFilePath = Path.Combine(publishDirectory, $"{applicationName}.deps.json");

            if (!File.Exists(depsFilePath))
            {
                Reporter.Verbose.WriteLine($"PublishedPathCommandResolver: {depsFilePath} does not exist");
                return(null);
            }

            var runtimeConfigPath = Path.Combine(publishDirectory, $"{applicationName}.runtimeconfig.json");

            if (!File.Exists(runtimeConfigPath))
            {
                Reporter.Verbose.WriteLine($"projectdependenciescommandresolver: {runtimeConfigPath} does not exist");
                return(null);
            }

            return(_commandSpecFactory.CreateCommandSpecFromPublishFolder(
                       commandPath,
                       commandResolverArguments.CommandArguments.OrEmptyIfNull(),
                       CommandResolutionStrategy.OutputPath,
                       depsFilePath,
                       runtimeConfigPath));
        }