Ejemplo n.º 1
0
        /// <summary>
        /// Creates new solution.
        /// </summary>
        public SolutionView(CrowIDE ide, string path)
        {
            this.IDE     = ide;
            this.path    = path;
            solutionFile = SolutionFile.Parse(path);
            UserConfig   = new Configuration(path + ".user");

            ActiveConfiguration = solutionFile.GetDefaultConfigurationName();
            ActivePlatform      = solutionFile.GetDefaultPlatformName();

            ide.projectCollection.SetGlobalProperty("SolutionDir", Path.GetDirectoryName(path) + "/");
            //ide.projectCollection.HostServices
            buildParams = new BuildParameters(ide.projectCollection)
            {
                Loggers     = ide.projectCollection.Loggers,
                ResetCaches = true,
                LogInitialPropertiesAndItems = true
            };
            //projectCollection.IsBuildEnabled = false;

            BuildManager.DefaultBuildManager.ResetCaches();

#if NET472
            ide.projectCollection.SetGlobalProperty("RoslynTargetsPath", Path.Combine(Startup.msbuildRoot, "Roslyn/"));
            ide.projectCollection.SetGlobalProperty("MSBuildSDKsPath", Path.Combine(Startup.msbuildRoot, "Sdks/"));
#endif
            //------------

            foreach (ProjectInSolution pis in solutionFile.ProjectsInOrder)
            {
                switch (pis.ProjectType)
                {
                case SolutionProjectType.Unknown:
                    break;

                case SolutionProjectType.KnownToBeMSBuildFormat:
                    Projects.Add(new ProjectView(this, pis));
                    break;

                case SolutionProjectType.SolutionFolder:
                    break;

                case SolutionProjectType.WebProject:
                    break;

                case SolutionProjectType.WebDeploymentProject:
                    break;

                case SolutionProjectType.EtpSubProject:
                    break;

                case SolutionProjectType.SharedProject:
                    break;
                }
            }

            ReloadStyling();
            ReloadDefaultTemplates();
        }
Ejemplo n.º 2
0
        async void load()
        {
            Microsoft.CodeAnalysis.Solution solution = await IDE.Workspace.OpenSolutionAsync(path, IDE.ProgressLogger);

            solutionFile = SolutionFile.Parse(path);
            UserConfig   = new Configuration(path + ".user");

            ActiveConfiguration = solutionFile.GetDefaultConfigurationName();
            ActivePlatform      = solutionFile.GetDefaultPlatformName();
        }
        private static IDictionary <string, string> SpecializeArgsForSolutionProject(SolutionFile solution, ProjectInSolution p, IDictionary <string, string> args)
        {
            var targetPlatform              = args.ContainsKey("Platform") ? args["Platform"] : solution.GetDefaultPlatformName();
            var targetConfiguration         = args.ContainsKey("Configuration") ? args["Configuration"] : solution.GetDefaultConfigurationName();
            var targetSolutionConfiguration =
                solution.SolutionConfigurations.FirstOrDefault(conf => conf.ConfigurationName == targetConfiguration && conf.PlatformName == targetPlatform)?.FullName;
            var foo  = targetSolutionConfiguration == null || !p.ProjectConfigurations.ContainsKey(targetSolutionConfiguration) ? null : p.ProjectConfigurations[targetSolutionConfiguration];
            var copy = new Dictionary <string, string>(args);

            copy["Platform"]      = foo == null ? targetPlatform : foo.PlatformName;
            copy["Configuration"] = foo == null ? targetConfiguration : foo.ConfigurationName;
            return(copy);
        }
 public string GetDefaultConfigurationName()
 {
     return(_solutionFile.GetDefaultConfigurationName());
 }