public void PublishTest(string solutionName, string stratupProjName, string platform, string clientProjName) { var testDir = GetTestDir(); var startupProjDir = Path.Combine(testDir, solutionName, stratupProjName); var clientProjDir = Path.Combine(testDir, solutionName, clientProjName); var binDir = Path.Combine(startupProjDir, "bin"); var objDir = Path.Combine(startupProjDir, "obj"); var distDir = Path.Combine(binDir, Path.Combine($"Debug/{platform}/publish/{clientProjName}/dist/content/i18ntext".Split('/'))); Delete(binDir); Delete(objDir); Run(clientProjDir, "dotnet", "add", "package", "Toolbelt.Blazor.I18nText"); ErrorLevel.Is(0); Run(clientProjDir, "dotnet", "add", "package", "Lib4PackRef"); ErrorLevel.Is(0); Run(testDir, "dotnet", "publish", $"{solutionName}.sln"); ErrorLevel.Is(0); Exists(distDir, "Lib4PackRef.I18nText.Text.en.json").IsTrue(); Exists(distDir, "Lib4PackRef.I18nText.Text.ja.json").IsTrue(); Exists(distDir, "Lib4ProjRef.I18nText.Text.en.json").IsTrue(); Exists(distDir, "Lib4ProjRef.I18nText.Text.ja.json").IsTrue(); }
private static void UpdateLibraryProjects() { var testDir = GetTestDir(); foreach (var libName in new[] { "Lib4PackRef", "Lib4ProjRef" }) { var libDir = Path.Combine(testDir, libName); var libProjPath = Path.Combine(libDir, libName + ".csproj"); var libProjDocBefore = XDocument.Load(libProjPath); var i18textVersionBefore = libProjDocBefore.Descendants("PackageReference").Where(node => node.Attribute("Include").Value == "Toolbelt.Blazor.I18nText").First().Attribute("Version").Value; Run(libDir, "dotnet", "add", "package", "Toolbelt.Blazor.I18nText"); ErrorLevel.Is(0); var libProjDocAfter = XDocument.Load(libProjPath); var i18textVersionAfter = libProjDocAfter.Descendants("PackageReference").Where(node => node.Attribute("Include").Value == "Toolbelt.Blazor.I18nText").First().Attribute("Version").Value; if (i18textVersionBefore != i18textVersionAfter) { var libVerNode = libProjDocAfter.Descendants("Version").First(); var libCurVer = Version.Parse(libVerNode.Value); var libNextVer = $"1.0.{libCurVer.Build + 1}"; libVerNode.Value = libNextVer; libProjDocAfter.Save(libProjPath); } Run(libDir, "dotnet", "build"); ErrorLevel.Is(0); } }