コード例 #1
0
        static void CheckConfigurationMappings(DotNetProject project, string currentConfig)
        {
            var projConfig = (DotNetProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
            if (project.GetConfigurations ().Contains (currentConfig) && projConfig.Name != currentConfig)
                LogIssue (project, "configuration", currentConfig, projConfig.Name);

            if (currentConfig.IndexOf ("Debug", StringComparison.OrdinalIgnoreCase) != -1)
                return;

            // Fixup entries for release configs.
            var debugEntry = project.ParentSolution
                .GetConfiguration (new SolutionConfigurationSelector (currentConfig.Replace ("Release", "Debug")))
                .GetEntryForItem (project);
            if (debugEntry == null)
                return;

            IdeApp.Workspace.ActiveConfigurationId = currentConfig;

            var entry = project.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration).GetEntryForItem (project);
            entry.Build = debugEntry.Build;
            entry.Deploy = debugEntry.Deploy;

            var newConfig = debugEntry.ItemConfiguration.Replace ("Debug", "Release");
            if (project.GetConfigurations ().Any (config => config == newConfig))
                entry.ItemConfiguration = newConfig;
            else {
                LogIssue (project, "configuration", newConfig, "Missing");
                entry.ItemConfiguration = debugEntry.ItemConfiguration;
            }
        }