Exemplo n.º 1
0
        private CommandSpec CreateNetCoreCommandSpec(ResolverArguments arguments)
        {
            Debug.Assert(!string.IsNullOrEmpty(arguments.RuntimeConfigJson), "RuntimeConfigJson is null or empty.");
            Debug.Assert(!string.IsNullOrEmpty(arguments.DepsJsonFile), "DepsJsonFile is null or empty.");

            var args = new List <string>();

            args.Add("exec");

            args.Add("--runtimeconfig");
            args.Add(arguments.RuntimeConfigJson);

            args.Add("--depsfile");
            args.Add(arguments.DepsJsonFile);

            if (!string.IsNullOrEmpty(arguments.NuGetPackageRoot))
            {
                args.Add("--additionalprobingpath");
                args.Add(arguments.NuGetPackageRoot);
            }

            var commandPath = Path.Combine(NetCoreToolDir, "ef" + FileNameSuffixes.DotNet.DynamicLib);

            args.Add(commandPath);
            args.AddRange(arguments.CommandArguments);

            var muxer       = new Muxer();
            var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args.OrEmptyIfNull());

            return(new CommandSpec(muxer.MuxerPath, escapedArgs, CommandResolutionStrategy.ProjectToolsPackage));
        }
Exemplo n.º 2
0
        private CommandSpec CreateDesktopCommandSpec(ResolverArguments arguments)
        {
            var exeName = RuntimeInformation.OSArchitecture == Architecture.X86
                ? "ef.x86" + FileNameSuffixes.Windows.Exe
                : "ef" + FileNameSuffixes.Windows.Exe;
            var path = Path.Combine(DesktopToolDir, exeName);

            return(new CommandSpec(path,
                                   ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(arguments.CommandArguments.OrEmptyIfNull()),
                                   CommandResolutionStrategy.ProjectToolsPackage));
        }
        private CommandSpec ResolveDesktopCommand(IProjectContext startupProject, IEnumerable <string> args)
        {
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                throw new OperationErrorException(string.Format(ToolsDotNetStrings.DesktopCommandsRequiresWindows, startupProject.TargetFramework));
            }

            var arguments = new ResolverArguments
            {
                IsDesktop        = true,
                CommandArguments = args,
                NuGetPackageRoot = startupProject.PackagesDirectory
            };

            return(_resolver.Resolve(arguments));
        }
        private CommandSpec ResolveDotNetCommand(IProjectContext startupProject, IEnumerable <string> args)
        {
            if (!File.Exists(startupProject.DepsJson))
            {
                throw new OperationErrorException(string.Format(ToolsDotNetStrings.MissingDepsJsonFile, startupProject.DepsJson));
            }

            var arguments = new ResolverArguments
            {
                IsDesktop         = false,
                CommandArguments  = args,
                DepsJsonFile      = startupProject.DepsJson,
                RuntimeConfigJson = startupProject.RuntimeConfigJson,
                NuGetPackageRoot  = startupProject.PackagesDirectory
            };

            return(_resolver.Resolve(arguments));
        }
Exemplo n.º 5
0
 public CommandSpec Resolve(ResolverArguments arguments)
 => arguments.IsDesktop
         ? CreateDesktopCommandSpec(arguments)
         : CreateNetCoreCommandSpec(arguments);