public static string ToVersionString(this MSBuildToolsVersion version) { switch (version) { case MSBuildToolsVersion.V2_0: return("2.0"); case MSBuildToolsVersion.V3_5: return("3.5"); case MSBuildToolsVersion.V4_0: return("4.0"); case MSBuildToolsVersion.V12_0: return("12.0"); case MSBuildToolsVersion.V14_0: return("14.0"); case MSBuildToolsVersion.V15_0: return("15.0"); default: return(ToVersionString(DEFAULT)); } }
public static bool TryParse(string versionString, out MSBuildToolsVersion version) { switch (versionString) { case "2.0": version = MSBuildToolsVersion.V2_0; return(true); case "3.5": version = MSBuildToolsVersion.V3_5; return(true); case "4.0": version = MSBuildToolsVersion.V4_0; return(true); case "12.0": version = MSBuildToolsVersion.V12_0; return(true); case "14.0": version = MSBuildToolsVersion.V14_0; return(true); case "15.0": version = MSBuildToolsVersion.V15_0; return(true); default: version = MSBuildToolsVersion.Unknown; return(true); } }
public void MSBuild4(string projectFile, IList<string> targets, Hashtable properties = null, int? maxCpuCount = null, bool? nodeReuse = null, bool showCommandLine = false, MSBuildToolsVersion? toolsVersion = null, MSBuildVerbosity? verbosity = null) { var task = new MSBuild40Task(FileSystem, Platform) { ProjectFile = projectFile, Targets = targets, MaxCpuCount = maxCpuCount, NodeReuse = nodeReuse, ShowCommandLine = showCommandLine, ToolsVersion = toolsVersion, Verbosity = verbosity }; foreach (var property in properties ?? new Dictionary<string, string>()) task.AddProperty(property.Key, property.Value); task.Run(); }
public static bool IsAtLeast(this MSBuildToolsVersion currentVersion, MSBuildToolsVersion minimumVersion) { if (currentVersion == MSBuildToolsVersion.Unknown) { currentVersion = DEFAULT; } return((int)currentVersion >= (int)minimumVersion); }
public static bool IsAtLeast(this MSBuildToolsVersion version, MSBuildToolsVersion other) { if (version == MSBuildToolsVersion.Unknown) { version = DEFAULT; } return((int)other >= (int)version); }
public static IEnumerable <BaseInfo> GetAttributeCompletions(this MSBuildResolveResult rr, IEnumerable <IMSBuildSchema> schemas, MSBuildToolsVersion tv) { bool isInTarget = false; if (rr.LanguageElement.Kind == MSBuildKind.Item) { isInTarget = rr.LanguageElement.IsInTarget(rr.XElement); } foreach (var att in rr.LanguageElement.Attributes) { var spat = schemas.SpecializeAttribute(att, rr.ElementName); if (!spat.IsAbstract) { if (rr.LanguageElement.Kind == MSBuildKind.Item) { if (isInTarget) { if (spat.Name == "Update") { continue; } } else { if (spat.Name == "KeepMetadata" || spat.Name == "RemoveMetadata" || spat.Name == "KeepDuplicates") { continue; } } } yield return(spat); } } if (rr.LanguageElement.Kind == MSBuildKind.Item && tv.IsAtLeast(MSBuildToolsVersion.V15_0)) { foreach (var item in schemas.GetMetadata(rr.ElementName, false)) { yield return(item); } } if (rr.LanguageElement.Kind == MSBuildKind.Task) { foreach (var parameter in schemas.GetTaskParameters(rr.ElementName)) { yield return(parameter); } } }
public MSBuildRuntimeInformation(TargetRuntime target, MSBuildToolsVersion tv) { this.target = target; this.sdkResolver = new MSBuildSdkResolver(target); this.tvString = tv.ToVersionString(); }