private static string ReplaceDependencyVersion(BuildTargetContext c, string fileContents, string dependencyPropertyName, string packageId) { Regex regex = new Regex($@"{dependencyPropertyName} = ""(?<version>.*)"";"); string newVersion = c.GetNewVersion(packageId); return(regex.ReplaceGroupValue(fileContents, "version", newVersion)); }
public static BuildTargetResult ReplaceCoreHostPackaging(BuildTargetContext c) { ReplaceFileContents(@"pkg\dir.props", contents => { Regex regex = new Regex(@"Microsoft\.NETCore\.Platforms\\(?<version>.*)\\runtime\.json"); string newNetCorePlatformsVersion = c.GetNewVersion("Microsoft.NETCore.Platforms"); return(regex.ReplaceGroupValue(contents, "version", newNetCorePlatformsVersion)); }); return(c.Success()); }