|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | namespace QtVsTools.Core | 
|---|
|  |  |  | { | 
|---|
|  |  |  | using System.Runtime.Remoting.Contexts; | 
|---|
|  |  |  | using EnvDTE80; | 
|---|
|  |  |  | using QtMsBuild; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static class HelperFunctions | 
|---|
|  |  |  | 
|---|
|  |  |  | var excluded = false; | 
|---|
|  |  |  | var fileConfigurations = (IVCCollection)vcfile.FileConfigurations; | 
|---|
|  |  |  | foreach (VCFileConfiguration config in fileConfigurations) { | 
|---|
|  |  |  | if (IsConfExcludeFromSolution(config)) | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | if (config.ExcludedFromBuild && config.MatchName(configurationName, false)) { | 
|---|
|  |  |  | excluded = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | 
|---|
|  |  |  | path += "\\"; | 
|---|
|  |  |  | return string.Format("\"{0}\"", path); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static bool IsConfExcludeFromSolution(VCFileConfiguration fileConfig) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ThreadHelper.ThrowIfNotOnUIThread(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var projectConfig = fileConfig.ProjectConfiguration as VCConfiguration; | 
|---|
|  |  |  | var projectPlatform = projectConfig.Platform as VCPlatform; | 
|---|
|  |  |  | var project = projectConfig.project as VCProject; | 
|---|
|  |  |  | var projectEnv = project.Object as Project; | 
|---|
|  |  |  | var dteEnv = projectEnv.DTE as DTE; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var contextList = new List<SolutionContext>(); | 
|---|
|  |  |  | foreach (SolutionConfiguration2 solutionCfg in dteEnv.Solution.SolutionBuild.SolutionConfigurations) { | 
|---|
|  |  |  | if (solutionCfg.PlatformName == projectPlatform.Name && solutionCfg.Name == projectConfig.ConfigurationName) { | 
|---|
|  |  |  | foreach (SolutionContext context in solutionCfg.SolutionContexts) { | 
|---|
|  |  |  | if (context.ProjectName.Contains(project.Name + ".vcxproj")) { | 
|---|
|  |  |  | // Äàííàÿ êîëëåêöèÿ áóäåò ñîäåðæàòü òîëüêî îäèí SolutionContext | 
|---|
|  |  |  | // Âîçìîæíî ïîçæå äîáàâèòü ïðîâåðêó ýòîãî | 
|---|
|  |  |  | contextList.Add(context); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return !contextList[0].ShouldBuild; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|