Ejemplo n.º 1
0
    public void ConfigureCallback()
    {
        try
        {
            var project = currentProjectFinder.GetCurrentProject();
            if (UnsaveProjectChecker.HasUnsavedPendingChanges(project))
            {
                return;
            }

            var projectReader = new ProjectReader(project.FullName);

            var model = new ConfigureWindowModel();
            var defaulter = new Defaulter();
            defaulter.ToModel(projectReader, model);

            var configureWindow = new ConfigureWindow(model);
            new WindowInteropHelper(configureWindow)
                {
                    Owner = GetActiveWindow()
                };
            if (configureWindow.ShowDialog().GetValueOrDefault())
            {
                Configure(model, project);
            }
        }
        catch (COMException exception)
        {
            exceptionDialog.HandleException(exception);
        }
        catch (Exception exception)
        {
            exceptionDialog.HandleException(exception);
        }
    }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //Load a project
            ProjectReader rdr = new ProjectReader();
            FileStream St = new FileStream("Project.mpp", FileMode.Open);
            Project prj = rdr.Read(St);
            St.Close();

            //Link the tasks
            TaskLink tsklnk = new TaskLink(prj.RootTask.Children[0] as Aspose.Tasks.Task, prj.RootTask.Children[1] as Aspose.Tasks.Task, TaskLinkType.FinishToStart);
            prj.AddTaskLink(tsklnk);
            tsklnk = new TaskLink(prj.RootTask.Children[1] as Aspose.Tasks.Task, prj.RootTask.Children[2] as Aspose.Tasks.Task, TaskLinkType.FinishToStart);
            prj.AddTaskLink(tsklnk);
            tsklnk = new TaskLink(prj.RootTask.Children[2] as Aspose.Tasks.Task, prj.RootTask.Children[3] as Aspose.Tasks.Task, TaskLinkType.FinishToStart);
            prj.AddTaskLink(tsklnk);
            tsklnk = new TaskLink(prj.RootTask.Children[3] as Aspose.Tasks.Task, prj.RootTask.Children[4] as Aspose.Tasks.Task, TaskLinkType.FinishToStart);
            prj.AddTaskLink(tsklnk);
            tsklnk = new TaskLink(prj.RootTask.Children[1] as Aspose.Tasks.Task, prj.RootTask.Children[4] as Aspose.Tasks.Task, TaskLinkType.FinishToStart);
            prj.AddTaskLink(tsklnk);

            //Display links among the tasks
            ArrayList allinks = new ArrayList(prj.TaskLinks);
            foreach (TaskLink tasklnk in allinks)
            {
                Console.WriteLine("From ID = " + tasklnk.PredTask.Id + "=>To ID = " + tasklnk.SuccTask.Id);
                Console.WriteLine("________________________________________");
            }
            //Save the project
            prj.Save("Project1.mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);
        }
Ejemplo n.º 3
0
    public void WithNoWeaving()
    {
        var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithNoWeaving.csproj");
        var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectInjectorTests", true);
        try
        {

            var injector = new CosturaProjectInjector
                           	{
                           		ToolsDirectory = @"Tools\",
                           		ProjectFile = targetFileInfo.FullName,
                           		TargetPath = "Foo.dll",
                           		Overwrite = false,
                           		IncludeDebugSymbols = false,
                           		DeleteReferences = false,
                           		MessageImportance = MessageImportance.High,
                           	};
            injector.Execute();

            var reader = new ProjectReader(targetFileInfo.FullName);

            Assert.IsFalse(reader.Overwrite.Value);
            Assert.IsFalse(reader.IncludeDebugSymbols.Value);
            Assert.IsFalse(reader.DeleteReferences.Value);
            Assert.AreEqual("Foo.dll", reader.TargetPath);
            Assert.AreEqual(@"Tools\", reader.ToolsDirectory);
            Assert.AreEqual(MessageImportance.High, reader.MessageImportance);
        }
        finally
        {
            targetFileInfo.Delete();
        }
    }
    public void WithNoWeaving()
    {
        var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithNoWeaving.csproj");
        var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectReaderTest", true);
        try
        {

            var reader = new ProjectReader(targetFileInfo.FullName);

            Assert.IsNull(reader.DependenciesDirectory);
            Assert.IsNull(reader.ToolsDirectory);
            Assert.IsNull(reader.CheckForEquality);
            Assert.IsNull(reader.CheckForIsChanged);
            Assert.IsNull(reader.ProcessFields);
            Assert.IsNull(reader.MessageImportance);
            Assert.IsNull(reader.TryToWeaveAllTypes);
            Assert.IsNull(reader.EventInvokerName);
            Assert.IsNull(reader.EventInvokerName);
            Assert.IsNull(reader.TargetPath);
            Assert.IsNull(reader.TargetNode);
            Assert.IsNull(reader.DependenciesDirectory);
        }
        finally
        {
            targetFileInfo.Delete();
        }
    }
Ejemplo n.º 5
0
 public void ToModel(ProjectReader projectReader, ConfigureWindowModel configureWindowModel)
 {
     configureWindowModel.MessageImportance = projectReader.MessageImportance.GetValueOrDefault(MessageImportance.Low);
     configureWindowModel.TargetPath = projectReader.TargetPath;
     configureWindowModel.Overwrite = projectReader.Overwrite.GetValueOrDefault(true);
     configureWindowModel.IncludeDebugSymbols = projectReader.IncludeDebugSymbols.GetValueOrDefault(true);
     configureWindowModel.DeleteReferences = projectReader.DeleteReferences.GetValueOrDefault(true);
     configureWindowModel.DeriveTargetPathFromBuildEngine = projectReader.TargetPath == null;
     configureWindowModel.ToolsDirectory = GetValueOrDefault(projectReader.ToolsDirectory, @"$(SolutionDir)Tools\");
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Create project from a project.json in string
        /// </summary>
        public static Project GetProject(string json,
                                         string projectName,
                                         string projectPath,
                                         ICollection<DiagnosticMessage> diagnostics = null)
        {
            var ms = new MemoryStream(Encoding.UTF8.GetBytes(json));

            var project = new ProjectReader().ReadProject(ms, projectName, projectPath, diagnostics);

            return project;
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            //Load MPP file using project reader
            ProjectReader reader = new ProjectReader();
            Project project = reader.Read("Project.mpp");

            //Load all tasks
            ArrayList allTasks = new ArrayList(project.RootTask.Children);


            //Loop through each task and read information related to tasks
            foreach (Aspose.Tasks.Task task in allTasks)
            {
                Console.WriteLine("Reading Task " + task.Name);
                Console.WriteLine("\nID: " + task.Id);
                Console.WriteLine("Start: " + task.Start);
                Console.WriteLine("Finish: " + task.Finish);
                Console.WriteLine("\n===========================\n");

                //Read any other information you need
            }

            //Loop through each resource and read information related to resources
            foreach (Resource resource in project.Resources)
            {
                string resourceType = null;
                switch (resource.Type)
                {
                    case ResourceType.Material:
                        resourceType = "Material";
                        break;
                    case ResourceType.Work:
                        resourceType = "Work";
                        break;
                    default:
                        resourceType = "Cost";
                        break;
                }
                Console.WriteLine("Reading Resource " + resource.Name);
                Console.WriteLine("\nID: " + resource.Id);
                Console.WriteLine("Type: " + resourceType);
                Console.WriteLine("\n===========================\n");

                //Read any other information you need
            }

            Console.ReadLine();

        }
        public void GetDescriptionAddsCoreReferences(string shortFrameworkName, string expectedNames)
        {
            string projectJson = @"{ ""frameworks"": { """ + shortFrameworkName + @""": {} } }";
            using (var strm = new MemoryStream(Encoding.UTF8.GetBytes(projectJson)))
            {
                var project = new ProjectReader().ReadProject(strm, "TheTestProject", @"C:\TestProject", diagnostics: null);
                var provider = new ProjectDependencyProvider();
                var expected = expectedNames.Split(',').Select(s => "fx/" + s).ToArray();
                var actual = provider.GetDescription(VersionUtility.ParseFrameworkName(shortFrameworkName), project)
                                     .Dependencies
                                     .Select(d => d.LibraryRange.Name).ToArray();

                Assert.Equal(expected, actual);
            }
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            //Open project file
            string fileName = "Project.mpp";
            ProjectReader reader = new ProjectReader();
            Project project = reader.Read(fileName);

            // Get the critical path
            ArrayList criticalPath = new ArrayList(project.GetCriticalPath());

            // Enumerate the tasks in the critical path
            foreach (Aspose.Tasks.Task task in criticalPath)
            {
                Console.WriteLine(task.Id + "  " + task.Name);
                Console.WriteLine(task.Start);
                Console.WriteLine(task.Finish + "\n");
            }
        }
Ejemplo n.º 10
0
 public void WithMinimalWeaving()
 {
     var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithMinimalWeaving.csproj");
     var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectReaderTest", true);
     try
     {
         var reader = new ProjectReader(targetFileInfo.FullName);
         Assert.IsNull(reader.Overwrite);
         Assert.IsNull(reader.IncludeDebugSymbols);
         Assert.IsNull(reader.DeleteReferences);
         Assert.IsNull(reader.TargetPath);
         Assert.AreEqual(@"$(SolutionDir)Tools\", reader.ToolsDirectory);
         Assert.IsNull(reader.MessageImportance);
     }
     finally
     {
         targetFileInfo.Delete();
     }
 }
    public void WithExistingWeaving()
    {
        var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithWeaving.csproj");
        var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectInjectorTests", true);

        try
        {
            var injector = new NotifyPropertyWeaverProjectInjector
            {
                CheckForEquality = false,
                CheckForIsChanged = false,
                DependenciesDirectory = @"Lib2\",
                ToolsDirectory = @"Tools2\",
                EventInvokerName = "OnPropertyChanged2",
                ProjectFile = targetFileInfo.FullName,
                IncludeAttributeAssembly = true,
                ProcessFields = false,
                Target = "AfterCompile",
                TargetPath = "Foo2.dll",
                TryToWeaveAllTypes = false,
                MessageImportance = MessageImportance.High,
            };
            injector.Execute();

            var reader = new ProjectReader(targetFileInfo.FullName);

            Assert.IsFalse(reader.CheckForEquality.Value);
            Assert.IsFalse(reader.CheckForIsChanged.Value);
            Assert.IsFalse(reader.TryToWeaveAllTypes.Value);
            Assert.IsFalse(reader.ProcessFields.Value);
            Assert.AreEqual("OnPropertyChanged2", reader.EventInvokerName);
            Assert.AreEqual("Foo2.dll", reader.TargetPath);
            Assert.AreEqual(@"Lib2\", reader.DependenciesDirectory);
            Assert.AreEqual(@"Tools2\", reader.ToolsDirectory);
            Assert.AreEqual(MessageImportance.High, reader.MessageImportance);

        }
        finally
        {
            targetFileInfo.Delete();
        }
    }
Ejemplo n.º 12
0
    public void WithNoWeavingNotChanged()
    {
        var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithNoWeaving.csproj");
        var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectRemoverTests", true);

        try
        {
            new ProjectRemover(targetFileInfo.FullName);
            var reader = new ProjectReader(targetFileInfo.FullName);
            Assert.IsNull(reader.Overwrite);
            Assert.IsNull(reader.IncludeDebugSymbols);
            Assert.IsNull(reader.DeleteReferences);
            Assert.IsNull(reader.TargetPath);
            Assert.IsNull(reader.ToolsDirectory);
        }
        finally
        {
            targetFileInfo.Delete();
        }
    }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            ProjectReader reader = new ProjectReader();
            Project project = reader.Read("Project.mpp");

            Aspose.Tasks.Task task = new Aspose.Tasks.Task("Task1");
            task.ActualStart = DateTime.Parse("23-Aug-2012");

            //Set duration in hours
            task.Duration = new TimeSpan(24, 0, 0);
            task.DurationFormat = TimeUnitType.Day;
            project.RootTask.Children.Add(task);

            //Recalculate task IDs
            project.CalcTaskIds();
            project.CalcTaskUids();

            //Save the Project as XML
            project.Save("OutputProject.xml", Aspose.Tasks.Saving.SaveFileFormat.XML);

        }
Ejemplo n.º 14
0
 public void ToModel(ProjectReader projectReader, ConfigureWindowModel configureWindowModel)
 {
     configureWindowModel.CheckForEquality = projectReader.CheckForEquality.GetValueOrDefault(true);
     configureWindowModel.CheckForIsChanged = projectReader.CheckForIsChanged.GetValueOrDefault(false);
     configureWindowModel.TryToWeaveAllTypes = projectReader.TryToWeaveAllTypes.GetValueOrDefault(true);
     configureWindowModel.ProcessFields = projectReader.ProcessFields.GetValueOrDefault(false);
     configureWindowModel.MessageImportance = projectReader.MessageImportance.GetValueOrDefault(MessageImportance.Low);
     if (projectReader.TargetNode == null)
     {
         configureWindowModel.TargetNode = "AfterCompile";
     }
     else
     {
         configureWindowModel.TargetNode = projectReader.TargetNode;
     }
     configureWindowModel.TargetPath = projectReader.TargetPath;
     configureWindowModel.DeriveTargetPathFromBuildEngine = projectReader.TargetPath == null;
     configureWindowModel.DependenciesDirectory = GetValueOrDefault(projectReader.DependenciesDirectory, @"$(SolutionDir)Lib\");
     configureWindowModel.ToolsDirectory = GetValueOrDefault(projectReader.ToolsDirectory, @"$(SolutionDir)Tools\");
     configureWindowModel.EventInvokerName = GetValueOrDefault(projectReader.EventInvokerName, "OnPropertyChanged");
     configureWindowModel.IncludeAttributeAssembly = !string.IsNullOrWhiteSpace(projectReader.DependenciesDirectory);
 }
Ejemplo n.º 15
0
    public void WithExistingWeaving()
    {
        var sourceProjectFile = new FileInfo(@"TestProjects\ProjectWithWeaving.csproj");
        var targetFileInfo = sourceProjectFile.CopyTo(sourceProjectFile.FullName + "ProjectReaderTest", true);
        try
        {
            var reader = new ProjectReader(targetFileInfo.FullName);

            Assert.IsTrue(reader.CheckForEquality.Value);
            Assert.IsTrue(reader.CheckForIsChanged.Value);
            Assert.IsTrue(reader.ProcessFields.Value);
            Assert.IsTrue(reader.TryToWeaveAllTypes.Value);
            Assert.AreEqual("OnPropertyChanged", reader.EventInvokerName);
            Assert.AreEqual("AfterCompile", reader.TargetNode);
            Assert.AreEqual("@(IntermediateAssembly)", reader.TargetPath);
            Assert.AreEqual("$(SolutionDir)Lib\\", reader.DependenciesDirectory);
            Assert.AreEqual("$(SolutionDir)Tools\\", reader.ToolsDirectory);
            Assert.AreEqual(MessageImportance.High, reader.MessageImportance);
        }
        finally
        {
            targetFileInfo.Delete();
        }
    }
Ejemplo n.º 16
0
 public GMConstant(ProjectReader reader)
 {
     Name  = reader.ReadString();
     Value = reader.ReadString();
 }
Ejemplo n.º 17
0
        public OperationExecutor(
            [NotNull] CommonOptions options,
            [CanBeNull] string startupProjectPath,
            [CanBeNull] string environment)
        {
            var projectFile = Path.Combine(Directory.GetCurrentDirectory(), Project.FileName);
            var project     = ProjectReader.GetProject(projectFile);

            startupProjectPath = startupProjectPath ?? projectFile;

            var projectConfiguration = options.Configuration ?? Constants.DefaultConfiguration;
            var projectFramework     = options.Framework;

            var startupConfiguration  = options.Configuration ?? Constants.DefaultConfiguration;
            var startupProjectContext = GetCompatibleStartupProjectContext(startupProjectPath, projectFramework);
            var startupFramework      = startupProjectContext.TargetFramework;

            var externalStartup = project.ProjectFilePath != startupProjectContext.ProjectFile.ProjectFilePath;

            if (externalStartup && !options.NoBuild)
            {
                Reporter.Verbose.WriteLine(ToolsCliStrings.LogBuildFailed.Bold().Black());

                var buildExitCode = BuildCommandFactory.Create(startupProjectPath,
                                                               startupConfiguration,
                                                               startupFramework,
                                                               options.BuildBasePath,
                                                               output: null)
                                    .ForwardStdOut()
                                    .ForwardStdErr()
                                    .Execute()
                                    .ExitCode;

                if (buildExitCode != 0)
                {
                    throw new OperationException(ToolsCliStrings.LogBuildFailed);
                }

                Reporter.Verbose.WriteLine(ToolsCliStrings.LogBuildSucceeded.Bold().Black());
            }

            var runtimeOutputPath = startupProjectContext.GetOutputPaths(startupConfiguration)?.RuntimeOutputPath;

            if (!string.IsNullOrEmpty(runtimeOutputPath))
            {
                Reporter.Verbose.WriteLine(
                    ToolsCliStrings.LogDataDirectory(runtimeOutputPath));
                Environment.SetEnvironmentVariable(DataDirEnvName, runtimeOutputPath);
#if NET451
                AppDomain.CurrentDomain.SetData("DataDirectory", runtimeOutputPath);
#endif
            }

            var startupAssemblyName = startupProjectContext.ProjectFile.GetCompilerOptions(startupFramework, startupConfiguration).OutputName;
            var assemblyName        = project.GetCompilerOptions(projectFramework, projectConfiguration).OutputName;
            var projectDir          = project.ProjectDirectory;
            var startupProjectDir   = startupProjectContext.ProjectFile.ProjectDirectory;
            var rootNamespace       = project.Name;

            var projectAssembly = Assembly.Load(new AssemblyName {
                Name = assemblyName
            });
#if NET451
            // TODO use app domains
            var startupAssemblyLoader = new AssemblyLoader(Assembly.Load);
#else
            AssemblyLoader startupAssemblyLoader;
            if (externalStartup)
            {
                var assemblyLoadContext = startupProjectContext.CreateLoadContext(
                    PlatformServices.Default.Runtime.GetRuntimeIdentifier(),
                    Constants.DefaultConfiguration);
                startupAssemblyLoader = new AssemblyLoader(assemblyLoadContext.LoadFromAssemblyName);
            }
            else
            {
                startupAssemblyLoader = new AssemblyLoader(Assembly.Load);
            }
#endif
            var startupAssembly = startupAssemblyLoader.Load(startupAssemblyName);

            _contextOperations = new LazyRef <DbContextOperations>(
                () => new DbContextOperations(
                    new LoggerProvider(name => new ConsoleCommandLogger(name)),
                    projectAssembly,
                    startupAssembly,
                    environment,
                    startupProjectDir));
            _databaseOperations = new LazyRef <DatabaseOperations>(
                () => new DatabaseOperations(
                    new LoggerProvider(name => new ConsoleCommandLogger(name)),
                    startupAssemblyLoader,
                    startupAssembly,
                    environment,
                    projectDir,
                    startupProjectDir,
                    rootNamespace));
            _migrationsOperations = new LazyRef <MigrationsOperations>(
                () => new MigrationsOperations(
                    new LoggerProvider(name => new ConsoleCommandLogger(name)),
                    projectAssembly,
                    startupAssemblyLoader,
                    startupAssembly,
                    environment,
                    projectDir,
                    startupProjectDir,
                    rootNamespace));
        }
Ejemplo n.º 18
0
        private static MicrosoftProjectDto ImportMicrosoftProject(string filename)
        {
            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }
            ProjectReader reader = ProjectReaderUtility.getProjectReader(filename);

            net.sf.mpxj.ProjectFile mpx = reader.read(filename);
            DateTime projectStart       = mpx.ProjectProperties.StartDate.ToDateTime();

            var resources = new List <ResourceDto>();

            foreach (var resource in mpx.Resources.ToIEnumerable <net.sf.mpxj.Resource>())
            {
                int id = resource.ID.intValue();
                if (id == 0)
                {
                    continue;
                }
                string name        = resource.Name;
                var    resourceDto = new ResourceDto
                {
                    Id = id,
                    IsExplicitTarget = true,
                    Name             = name,
                    DisplayOrder     = id,
                    ColorFormat      = new ColorFormatDto()
                };
                resources.Add(resourceDto);
            }

            var dependentActivities = new List <DependentActivityDto>();

            foreach (var task in mpx.Tasks.ToIEnumerable <net.sf.mpxj.Task>())
            {
                int id = task.ID.intValue();
                if (id == 0)
                {
                    continue;
                }
                string name     = task.Name;
                int    duration = Convert.ToInt32(task.Duration.Duration);

                DateTime?minimumEarliestStartDateTime = null;
                if (task.ConstraintType == net.sf.mpxj.ConstraintType.START_NO_EARLIER_THAN)
                {
                    //minimumEarliestStartTime = Convert.ToInt32((task.ConstraintDate.ToDateTime() - projectStart).TotalDays);
                    minimumEarliestStartDateTime = task.ConstraintDate.ToDateTime();
                }

                var targetResources = new List <int>();
                foreach (var resourceAssignment in task.ResourceAssignments.ToIEnumerable <net.sf.mpxj.ResourceAssignment>())
                {
                    if (resourceAssignment.Resource != null)
                    {
                        targetResources.Add(resourceAssignment.Resource.ID.intValue());
                    }
                }

                var dependencies = new List <int>();
                var preds        = task.Predecessors;
                if (preds != null && !preds.isEmpty())
                {
                    foreach (var pred in preds.ToIEnumerable <net.sf.mpxj.Relation>())
                    {
                        dependencies.Add(pred.TargetTask.ID.intValue());
                    }
                }
                var dependentActivityDto = new DependentActivityDto
                {
                    Activity = new ActivityDto
                    {
                        Id              = id,
                        Name            = name,
                        TargetResources = targetResources,
                        Duration        = duration,
                        MinimumEarliestStartDateTime = minimumEarliestStartDateTime
                    },
                    Dependencies         = dependencies,
                    ResourceDependencies = new List <int>()
                };
                dependentActivities.Add(dependentActivityDto);
            }
            return(new MicrosoftProjectDto
            {
                ProjectStart = projectStart,
                DependentActivities = dependentActivities.ToList(),
                Resources = resources.ToList()
            });
        }
Ejemplo n.º 19
0
 public ProjectConverter(ILogger logger, ConversionOptions conversionOptions = null)
 {
     this.logger            = logger;
     this.conversionOptions = conversionOptions ?? new ConversionOptions();
     this.projectReader     = new ProjectReader(logger, this.conversionOptions);
 }
Ejemplo n.º 20
0
 private void Load_Options(ProjectReader reader)
 {
     Options = new GMOptions(reader);
 }
        public void TransformsFiles()
        {
            var project = new ProjectReader().Read(Path.Combine("TestFiles", "FileInclusion", "fileinclusion.testcsproj"));

            project.CodeFileExtension = "cs";
            var transformation = new FileTransformation();

            transformation.Transform(project);

            var includeItems = project.ItemGroups.SelectMany(x => x.Elements()).ToImmutableList();

            Assert.AreEqual(29, includeItems.Count);

            Assert.AreEqual(12, includeItems.Count(x => x.Name.LocalName == "Reference"));
            Assert.AreEqual(2, includeItems.Count(x => x.Name.LocalName == "ProjectReference"));
            Assert.AreEqual(11, includeItems.Count(x => x.Name.LocalName == "Compile"));
            Assert.AreEqual(5, includeItems.Count(x => x.Name.LocalName == "Compile" && x.Attribute("Update") != null));
            Assert.AreEqual(4, includeItems.Count(x => x.Name.LocalName == "Compile" && x.Attribute("Include") != null));
            Assert.AreEqual(2, includeItems.Count(x => x.Name.LocalName == "Compile" && x.Attribute("Remove") != null));
            Assert.AreEqual(3, includeItems.Count(x => x.Name.LocalName == "EmbeddedResource"));             // #73 include things that are not ending in .resx
            Assert.AreEqual(0, includeItems.Count(x => x.Name.LocalName == "Content"));
            Assert.AreEqual(1, includeItems.Count(x => x.Name.LocalName == "None"));
            Assert.AreEqual(0, includeItems.Count(x => x.Name.LocalName == "Analyzer"));

            var resourceDesigner = includeItems.Single(
                x => x.Name.LocalName == "Compile" &&
                x.Attribute("Update")?.Value == @"Properties\Resources.Designer.cs"
                );

            Assert.AreEqual(3, resourceDesigner.Elements().Count());
            var dependentUponElement = resourceDesigner.Elements().Single(x => x.Name.LocalName == "DependentUpon");

            Assert.AreEqual("Resources.resx", dependentUponElement.Value);

            var linkedFile = includeItems.Single(
                x => x.Name.LocalName == "Compile" &&
                x.Attribute("Include")?.Value == @"..\OtherTestProjects\OtherTestClass.cs"
                );
            var linkAttribute = linkedFile.Attributes().FirstOrDefault(a => a.Name.LocalName == "Link");

            Assert.IsNotNull(linkAttribute);
            Assert.AreEqual("OtherTestClass.cs", linkAttribute.Value);

            var sourceWithDesigner = includeItems.Single(
                x => x.Name.LocalName == "Compile" &&
                x.Attribute("Update")?.Value == @"SourceFileWithDesigner.cs"
                );

            var subTypeElement = sourceWithDesigner.Elements().Single();

            Assert.AreEqual("SubType", subTypeElement.Name.LocalName);
            Assert.AreEqual("Component", subTypeElement.Value);

            var designerForSource = includeItems.Single(
                x => x.Name.LocalName == "Compile" &&
                x.Attribute("Update")?.Value == @"SourceFileWithDesigner.Designer.cs"
                );

            var dependentUponElement2 = designerForSource.Elements().Single();

            Assert.AreEqual("DependentUpon", dependentUponElement2.Name.LocalName);
            Assert.AreEqual("SourceFileWithDesigner.cs", dependentUponElement2.Value);

            var fileWithAnotherAttribute = includeItems.Single(
                x => x.Name.LocalName == "Compile" &&
                x.Attribute("Update")?.Value == @"AnotherFile.cs"
                );

            Assert.AreEqual(2, fileWithAnotherAttribute.Attributes().Count());
            Assert.AreEqual("AttrValue", fileWithAnotherAttribute.Attribute("AnotherAttribute")?.Value);

            var removeMatchingWildcard = includeItems.Where(
                x => x.Name.LocalName == "Compile" &&
                x.Attribute("Remove")?.Value != null
                )
                                         .ToImmutableList();

            Assert.IsNotNull(removeMatchingWildcard);
            Assert.AreEqual(2, removeMatchingWildcard.Count);
            Assert.IsTrue(removeMatchingWildcard.Any(x => x.Attribute("Remove")?.Value == "SourceFileAsResource.cs"));
            Assert.IsTrue(removeMatchingWildcard.Any(x => x.Attribute("Remove")?.Value == "Class1.cs"));
        }
Ejemplo n.º 22
0
        private void Load_Main(ProjectReader reader)
        {
            int Magic = reader.ReadInt32();

            if (Magic != GMMagic)
            {
                throw new InvalidDataException($"Wrong project magic, got " + Magic);
            }

            Version = reader.ReadInt32();

            if (Version != 800 && Version != 810)
            {
                throw new InvalidDataException("This library only supports GM8.x files.");
            }

            Report("Header");
            Load_Header(reader);
            Report("Options");
            Load_Options(reader);
            Report("Triggers");
            Load_Triggers(reader);
            Report("Constants");
            Load_Constants(reader);
            Report("Sounds");
            Load_Sounds(reader);
            Report("Sprites");
            Load_Sprites(reader);
            Report("Backgrounds");
            Load_Backgrounds(reader);
            Report("Paths");
            Load_Paths(reader);
            Report("Scripts");
            Load_Scripts(reader);
            Report("Fonts");
            Load_Fonts(reader);
            Report("Timelines");
            Load_Timelines(reader);
            Report("Objects");
            Load_Objects(reader);
            Report("Rooms");
            Load_Rooms(reader);
            Report("Last IDs");
            Load_LastIDs(reader);
            Report("Included Files");
            Load_IncludedFiles(reader);
            Report("Extensions");
            Load_ExtensionPackages(reader);
            Report("Game Information");
            Load_GameInformation(reader);
            Report("Library creation code");
            Load_LibCreationCode(reader);
            Report("Room Execution order");
            Load_RoomOrder(reader);
            Report("Post fixups");
            PostLoad();

            // *try* to load the resource tree...
            Report("Resource tree");
            Load_ResourceTree(reader);

            Report("Done!");
        }
Ejemplo n.º 23
0
 private void Load_Header(ProjectReader reader)
 {
     GameID         = reader.ReadInt32();
     DirectPlayGuid = reader.ReadGuid();
 }
Ejemplo n.º 24
0
        public GMOptions(ProjectReader reader)
        {
            int version = reader.ReadInt32();
            int val;

            if (version < 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            FormatVersion = version;
            var dec_reader = reader.MakeReaderZlib();

            StartInFullscreen = dec_reader.ReadBoolean();
            InterpolatePixels = dec_reader.ReadBoolean();
            DontDrawBorder    = dec_reader.ReadBoolean();
            DisplayCursor     = dec_reader.ReadBoolean();
            Scaling           = dec_reader.ReadInt32();
            AllowWindowResize = dec_reader.ReadBoolean();
            AlwaysOnTop       = dec_reader.ReadBoolean();
            OutsideRoom       = dec_reader.ReadColor();
            SetResolution     = dec_reader.ReadBoolean();
            ColorDepth        = (ColourDepth)dec_reader.ReadInt32();
            ScreenResolution  = (Resolution)dec_reader.ReadInt32();
            Frequency         = (ScreenFrequency)dec_reader.ReadInt32();
            Borderless        = dec_reader.ReadBoolean();
            val                 = dec_reader.ReadInt32();
            VSync               = (val & 0x01) != 0;
            SoftwareVertex      = (val & 0x80000000) != 0;
            DisableScreensavers = dec_reader.ReadBoolean();

            LetF4Fullscreen = dec_reader.ReadBoolean();
            LetF1GameInfo   = dec_reader.ReadBoolean();
            LetESCEndGame   = dec_reader.ReadBoolean();
            LetF5F6SaveLoad = dec_reader.ReadBoolean();
            LetF9Screenshot = dec_reader.ReadBoolean();
            TreatCloseAsESC = dec_reader.ReadBoolean();

            Priority            = (GamePriority)dec_reader.ReadInt32();
            FreezeWhenFocusLost = dec_reader.ReadBoolean();
            LoadingBarMode      = (ProgBars)dec_reader.ReadInt32();
            BackLoadingBar      = null;
            FrontLoadingBar     = null;
            if (LoadingBarMode == ProgBars.BAR_CUSTOM)
            {
                if (dec_reader.ReadBoolean())
                {
                    BackLoadingBar = dec_reader.ReadZlibImage();
                }
                if (dec_reader.ReadBoolean())
                {
                    FrontLoadingBar = dec_reader.ReadZlibImage();
                }
            }
            ShowCustomLoadImage = dec_reader.ReadBoolean();
            LoadingImage        = null;
            if (ShowCustomLoadImage)
            {
                if (dec_reader.ReadBoolean())
                {
                    LoadingImage = dec_reader.ReadZlibImage();
                }
            }
            LoadimgImagePartTransparent = dec_reader.ReadBoolean();
            LoadImageAlpha   = dec_reader.ReadInt32();
            ScaleProgressBar = dec_reader.ReadBoolean();
            GameIcon         = dec_reader.ReadIcon();
            DisplayErrors    = dec_reader.ReadBoolean();
            WriteToLog       = dec_reader.ReadBoolean();
            AbortOnAllErrors = dec_reader.ReadBoolean();
            val = dec_reader.ReadInt32();
            TreatUninitAsZero = (val & 0x01) != 0;
            ErrorOnArguments  = (val & 0x02) != 0;

            /*
             * if (version >= 820)
             * {
             *  WebGL = dec_reader.ReadInt32();
             *  SwapEventOrder = dec_reader.ReadBoolean();
             * }
             */

            Author             = dec_reader.ReadString();
            Version            = dec_reader.ReadString();
            LastChanged        = dec_reader.ReadDate();
            Information        = dec_reader.ReadString();
            GameVersion        = dec_reader.ReadVersion();
            Company            = dec_reader.ReadString();
            Product            = dec_reader.ReadString();
            Copyright          = dec_reader.ReadString();
            Description        = dec_reader.ReadString();
            OptionsLastChanged = dec_reader.ReadDate();
        }
Ejemplo n.º 25
0
        public static CommandLineApplication Create()
        {
            var app = new CommandLineApplication(throwOnUnexpectedArg: false)
            {
                Name     = "dotnet ef",
                FullName = "Entity Framework .NET Core CLI Commands"
            };

            // TODO better help output https://github.com/aspnet/EntityFramework/issues/5188
            // app.HelpOption("-h|--help");

            var targetProjectOption = app.Option(
                "-p|--project <PROJECT>",
                "The project to target (defaults to the project in the current directory). Can be a path to a project.json or a project directory.");
            var startupProjectOption = app.Option(
                "-s|--startup-project <PROJECT>",
                "The path to the project containing Startup (defaults to the target project). Can be a path to a project.json or a project directory.");
            var configurationOption = app.Option(
                "-c|--configuration <CONFIGURATION>",
                $"Configuration under which to load (defaults to {Constants.DefaultConfiguration})");
            var frameworkOption = app.Option(
                "-f|--framework <FRAMEWORK>",
                $"Target framework to load from the startup project (defaults to the framework most compatible with {FrameworkConstants.CommonFrameworks.NetCoreApp10}).");
            var buildBasePathOption = app.Option(
                "-b|--build-base-path <OUTPUT_DIR>",
                "Directory in which to find temporary outputs.");
            var outputOption = app.Option(
                "-o|--output <OUTPUT_DIR>",
                "Directory in which to find outputs");
            var noBuildOption = app.Option("--no-build", "Do not build before executing.");

            app.OnExecute(() =>
            {
                var targetProjectPath = targetProjectOption.HasValue()
                    ? targetProjectOption.Value()
                    : Directory.GetCurrentDirectory();

                Project targetProject;
                if (!ProjectReader.TryGetProject(targetProjectPath, out targetProject))
                {
                    throw new OperationException($"Could not load target project '{targetProjectPath}'");
                }

                Reporter.Verbose.WriteLine(ToolsStrings.LogUsingTargetProject(targetProject.Name));

                Project startupProject;
                if (startupProjectOption.HasValue())
                {
                    var startupPath = startupProjectOption.Value();
                    if (!ProjectReader.TryGetProject(startupPath, out startupProject))
                    {
                        throw new OperationException($"Could not load project '{startupPath}'");
                    }
                }
                else
                {
                    startupProject = targetProject;
                }

                Reporter.Verbose.WriteLine(ToolsStrings.LogUsingStartupProject(startupProject.Name));

                var startupFramework = frameworkOption.HasValue()
                    ? NuGetFramework.Parse(frameworkOption.Value())
                    : null;

                if (startupFramework == null)
                {
                    var frameworks   = startupProject.GetTargetFrameworks().Select(i => i.FrameworkName);
                    startupFramework = NuGetFrameworkUtility.GetNearest(frameworks, FrameworkConstants.CommonFrameworks.NetCoreApp10, f => f)
                                       ?? frameworks.FirstOrDefault();

                    Reporter.Verbose.WriteLine(ToolsStrings.LogUsingFramework(startupFramework.GetShortFolderName()));
                }

                var configuration = configurationOption.Value();

                if (configuration == null)
                {
                    configuration = Constants.DefaultConfiguration;

                    Reporter.Verbose.WriteLine(ToolsStrings.LogUsingConfiguration(configuration));
                }

                if (!noBuildOption.HasValue())
                {
                    var buildExitCode = BuildCommandFactory.Create(
                        startupProject.ProjectFilePath,
                        configuration,
                        startupFramework,
                        buildBasePathOption.Value(),
                        outputOption.Value())
                                        .ForwardStdErr()
                                        .ForwardStdOut()
                                        .Execute()
                                        .ExitCode;
                    if (buildExitCode != 0)
                    {
                        throw new OperationException(ToolsStrings.BuildFailed(startupProject.Name));
                    }
                }

                var startupProjectContext = ProjectContext.Create(
                    startupProject.ProjectFilePath,
                    startupFramework,
                    RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());

                var startupOutputPaths = startupProjectContext
                                         .GetOutputPaths(configuration, buildBasePathOption.Value(), outputOption.Value());

                // TODO remove when https://github.com/dotnet/cli/issues/2645 is resolved
                Func <bool> isClassLibrary = () =>
                {
                    return(startupOutputPaths.RuntimeFiles == null ||
                           (
                               startupFramework.IsDesktop()
                                ? !Directory.Exists(startupOutputPaths.RuntimeFiles.BasePath)
                                : !File.Exists(startupOutputPaths.RuntimeFiles.RuntimeConfigJson) || !File.Exists(startupOutputPaths.RuntimeFiles.DepsJson)
                           ));
                };

                Reporter.Verbose.WriteLine(ToolsStrings.LogDataDirectory(startupOutputPaths.RuntimeOutputPath));

                // Workaround https://github.com/dotnet/cli/issues/3164
                var isExecutable = startupProject.GetCompilerOptions(startupFramework, configuration).EmitEntryPoint
                                   ?? startupProject.GetCompilerOptions(null, configuration).EmitEntryPoint.GetValueOrDefault();

                var startupAssembly = isExecutable
                    ? startupOutputPaths.RuntimeFiles.Executable
                    : startupOutputPaths.RuntimeFiles.Assembly;

                var targetAssembly = targetProject.ProjectFilePath.Equals(startupProject.ProjectFilePath)
                    ? startupAssembly
                                     // This assumes the target assembly is present in the startup project context and is a *.dll
                                     // TODO create a project context for target project as well to ensure filename is correct
                    : Path.Combine(startupOutputPaths.RuntimeOutputPath,
                                   targetProject.GetCompilerOptions(null, configuration).OutputName + FileNameSuffixes.DotNet.DynamicLib);

                Reporter.Verbose.WriteLine(ToolsStrings.LogBeginDispatch(ProjectDependencyToolName, startupProject.Name));

                try
                {
                    bool isVerbose;
                    bool.TryParse(Environment.GetEnvironmentVariable(CommandContext.Variables.Verbose), out isVerbose);
                    var dispatchArgs = CreateArgs(
                        assembly: targetAssembly,
                        startupAssembly: startupOutputPaths.RuntimeFiles.Assembly,
                        dispatcherVersion: ThisAssemblyVersion,
                        dataDir: startupOutputPaths.RuntimeOutputPath,
                        contentRootPath: startupProject.ProjectDirectory,
                        projectDir: targetProject.ProjectDirectory,
                        rootNamespace: targetProject.Name,
                        verbose: isVerbose)
                                       .Concat(app.RemainingArguments);

                    var buildBasePath = buildBasePathOption.Value();
                    if (buildBasePath != null && !Path.IsPathRooted(buildBasePath))
                    {
                        // ProjectDependenciesCommandFactory cannot handle relative build base paths.
                        buildBasePath = Path.Combine(Directory.GetCurrentDirectory(), buildBasePath);
                    }

                    return(new ProjectDependenciesCommandFactory(
                               startupFramework,
                               configuration,
                               outputOption.Value(),
                               buildBasePath,
                               startupProject.ProjectDirectory)
                           .Create(ProjectDependencyToolName, dispatchArgs, startupFramework, configuration)
                           .ForwardStdErr()
                           .ForwardStdOut()
                           .Execute()
                           .ExitCode);
                }
                catch (CommandUnknownException ex)
                {
                    Reporter.Verbose.WriteLine(ex.Message);

                    var fwlink = "http://go.microsoft.com/fwlink/?LinkId=798221";

                    if (isClassLibrary())
                    {
                        Reporter.Error.WriteLine(
                            ToolsStrings.ClassLibrariesNotSupportedInCli(startupProject.Name, fwlink).Bold().Red());
                    }
                    else if (startupFramework.IsDesktop() && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        Reporter.Error.WriteLine(
                            ToolsStrings.DesktopCommandsRequiresWindows(startupFramework.GetShortFolderName()).Bold().Red());
                    }
                    else
                    {
                        Reporter.Error.WriteLine(
                            ToolsStrings.ProjectDependencyCommandNotFound(
                                startupProject.Name,
                                ProjectDependencyToolName,
                                DispatcherToolName,
                                fwlink).Bold().Red());
                    }

                    return(1);
                }
            });

            return(app);
        }
Ejemplo n.º 26
0
        public static ISolutionBuilder Builder()
        {
            var files = SolutionFiles.FromDirectory(RippleFileSystem.CurrentDirectory());

            return(new SolutionBuilder(files, ProjectReader.Basic()));
        }
Ejemplo n.º 27
0
 private void Load_LastIDs(ProjectReader reader)
 {
     LastInstanceID = reader.ReadInt32();
     LastTileID     = reader.ReadInt32();
 }
Ejemplo n.º 28
0
        public GMRoom(ProjectReader reader, GMProject proj)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            Caption     = reader.ReadString();
            Width       = reader.ReadUInt32();
            Height      = reader.ReadUInt32();
            int _snx = reader.ReadInt32();
            int _sny = reader.ReadInt32();

            Snap            = new Point(_snx, _sny);
            Isometric       = reader.ReadBoolean();
            Speed           = reader.ReadUInt32();
            Persistent      = reader.ReadBoolean();
            BackgroundColor = reader.ReadColor();
            int val = reader.ReadInt32();

            DrawBackgroundColor    = (val & 1) != 0;
            ClearBGWithWindowColor = (val & 0b10) == 0;
            CreationCode           = reader.ReadString();

            // Read room backgrounds.
            int bgcount = reader.ReadInt32();

            Backgrounds = new List <RoomBackground>(bgcount);
            for (int i = 0; i < bgcount; i++)
            {
                var bgstruct = new RoomBackground();
                bgstruct.Load(reader, proj);
                Backgrounds.Add(bgstruct);
            }

            // Read views.
            EnableViews = reader.ReadBoolean();
            int viewcount = reader.ReadInt32();

            Views = new List <RoomView>(viewcount);
            for (int i = 0; i < viewcount; i++)
            {
                var viewstruct = new RoomView();
                viewstruct.Load(reader, proj);
                Views.Add(viewstruct);
            }

            // Read room instances.
            int instcount = reader.ReadInt32();

            Instances = new List <RoomInstance>(instcount);
            for (int i = 0; i < instcount; i++)
            {
                var inststruct = new RoomInstance();
                inststruct.Load(reader, proj);
                Instances.Add(inststruct);
            }

            // Read room tiles.
            int tilecount = reader.ReadInt32();

            Tiles = new List <RoomTile>(tilecount);
            for (int i = 0; i < tilecount; i++)
            {
                var tilestruct = new RoomTile();
                tilestruct.Load(reader, proj);
                Tiles.Add(tilestruct);
            }

            // weird editor settings (aren't really important unless you make an IDE)
            REI                 = reader.ReadBoolean();
            EditorWidth         = reader.ReadInt32();
            EditorHeight        = reader.ReadInt32();
            ShowGrid            = reader.ReadBoolean();
            ShowObjects         = reader.ReadBoolean();
            ShowTiles           = reader.ReadBoolean();
            ShowBGs             = reader.ReadBoolean();
            ShowFGs             = reader.ReadBoolean();
            ShowViews           = reader.ReadBoolean();
            DeleteUnderlyingObj = reader.ReadBoolean();
            DeleteUnderlyingTil = reader.ReadBoolean();
            Tab                 = (EditorTab)reader.ReadInt32();
            int _hx = reader.ReadInt32();
            int _hy = reader.ReadInt32();

            Scrollbar = new Point(_hx, _hy);

            reader.Dispose();
        }
Ejemplo n.º 29
0
 public MSProjectFileWorker()
 {
     projectReader = new MPPReader();
 }
        private Project GetProject(JObject json, ProjectReaderSettings settings = null)
        {
            using (var stream = new MemoryStream())
            {
                using (var sw = new StreamWriter(stream, Encoding.UTF8, 256, true))
                {
                    using (var writer = new JsonTextWriter(sw))
                    {
                        writer.Formatting = Formatting.Indented;
                        json.WriteTo(writer);
                    }

                    stream.Position = 0;
                    var projectReader = new ProjectReader();
                    return projectReader.ReadProject(
                        stream,
                        ProjectName,
                        ProjectFilePath,
                        settings);
                }
            }
        }
Ejemplo n.º 31
0
        public static CommandLineApplication Create()
        {
            var app = new CommandLineApplication(throwOnUnexpectedArg: false)
            {
                Name     = "dotnet ef",
                FullName = "Entity Framework .NET Core CLI Commands Dispatcher"
            };

            var noBuildOption = app.Option("--no-build", "Do not build before executing");

            var configurationOption = app.Option(
                "-c|--configuration <CONFIGURATION>",
                "Configuration under which to load");
            var frameworkOption = app.Option(
                "-f|--framework <FRAMEWORK>",
                "Target framework to load");
            var buildBasePathOption = app.Option(
                "-b|--build-base-path <OUTPUT_DIR>",
                "Directory in which to find temporary outputs");
            var outputOption = app.Option(
                "-o|--output <OUTPUT_DIR>",
                "Directory in which to find outputs");

            app.OnExecute(() =>
            {
                var project = Directory.GetCurrentDirectory();

                Reporter.Verbose.WriteLine(ToolsStrings.LogUsingProject(project));

                var projectFile = ProjectReader.GetProject(project);

                var framework = frameworkOption.HasValue()
                    ? NuGetFramework.Parse(frameworkOption.Value())
                    : null;

                if (framework == null)
                {
                    var frameworks = projectFile.GetTargetFrameworks().Select(i => i.FrameworkName);
                    framework      = NuGetFrameworkUtility.GetNearest(frameworks, FrameworkConstants.CommonFrameworks.NetCoreApp10, f => f)
                                     ?? frameworks.FirstOrDefault();

                    Reporter.Verbose.WriteLine(ToolsStrings.LogUsingFramework(framework.GetShortFolderName()));
                }

                var configuration = configurationOption.Value();

                if (configuration == null)
                {
                    configuration = Constants.DefaultConfiguration;

                    Reporter.Verbose.WriteLine(ToolsStrings.LogUsingConfiguration(configuration));
                }

                if (!noBuildOption.HasValue())
                {
                    var buildExitCode = BuildCommandFactory.Create(
                        projectFile.ProjectFilePath,
                        configuration,
                        framework,
                        buildBasePathOption.Value(),
                        outputOption.Value())
                                        .ForwardStdErr()
                                        .ForwardStdOut()
                                        .Execute()
                                        .ExitCode;
                    if (buildExitCode != 0)
                    {
                        throw new OperationException(ToolsStrings.BuildFailed(projectFile.Name));
                    }
                }

                // TODO remove when https://github.com/dotnet/cli/issues/2645 is resolved
                Func <bool> isClassLibrary = () =>
                {
                    var projectContext = ProjectContext.Create(
                        projectFile.ProjectFilePath,
                        framework,
                        RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());

                    var runtimeFiles = projectContext
                                       .GetOutputPaths(configuration, buildBasePathOption.Value(), outputOption.Value())
                                       ?.RuntimeFiles;

                    return(runtimeFiles == null ||
                           (
                               framework.IsDesktop()
                                ? !Directory.Exists(runtimeFiles.BasePath)
                                : !File.Exists(runtimeFiles.RuntimeConfigJson) || !File.Exists(runtimeFiles.DepsJson)
                           ));
                };

                Reporter.Verbose.WriteLine(ToolsStrings.LogBeginDispatch(ProjectDependencyToolName, projectFile.Name));

                try
                {
                    bool isVerbose;
                    bool.TryParse(Environment.GetEnvironmentVariable(CommandContext.Variables.Verbose), out isVerbose);
                    var dispatchArgs = ExecuteCommand
                                       .CreateArgs(framework, configuration, isVerbose)
                                       .Concat(app.RemainingArguments);

                    return(DotnetToolDispatcher.CreateDispatchCommand(
                               dispatchArgs,
                               framework,
                               configuration,
                               outputPath: outputOption.Value(),
                               buildBasePath: buildBasePathOption.Value(),
                               projectDirectory: projectFile.ProjectDirectory,
                               toolName: ProjectDependencyToolName)
                           .ForwardStdErr()
                           .ForwardStdOut()
                           .Execute()
                           .ExitCode);
                }
                catch (CommandUnknownException ex)
                {
                    Reporter.Verbose.WriteLine(ex.Message);

                    var fwlink = "http://go.microsoft.com/fwlink/?LinkId=798221";

                    if (isClassLibrary())
                    {
                        Reporter.Error.WriteLine(ToolsStrings.ClassLibrariesNotSupportedInCli(fwlink));
                    }
                    else
                    {
                        // intentionally put DispatcherToolName in error because "Microsoft.EntityFrameworkCore.Tools.Cli" is
                        // brought in automatically as a dependency of "Microsoft.EntityFrameworkCore.Tools"
                        Reporter.Error.WriteLine(ToolsStrings.ProjectDependencyCommandNotFound(DispatcherToolName, fwlink));
                    }

                    return(1);
                }
            });

            return(app);
        }