diff options
Diffstat (limited to 'src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs')
| -rw-r--r-- | src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs b/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs new file mode 100644 index 00000000..d4815bde --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/MsbuildUtilities.cs | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | // Copyright(c) .NET Foundation and contributors.All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.MSBuild | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.IO; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | |||
| 10 | public enum BuildSystem | ||
| 11 | { | ||
| 12 | MSBuild, | ||
| 13 | MSBuild64, | ||
| 14 | } | ||
| 15 | |||
| 16 | public static class MsbuildUtilities | ||
| 17 | { | ||
| 18 | public static readonly string WixPropsPath = Path.Combine(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "build", "WixToolset.MSBuild.props"); | ||
| 19 | |||
| 20 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, params string[] arguments) | ||
| 21 | { | ||
| 22 | var allArgs = new List<string> | ||
| 23 | { | ||
| 24 | $"-p:WixMSBuildProps={MsbuildUtilities.WixPropsPath}", | ||
| 25 | }; | ||
| 26 | |||
| 27 | if (arguments != null) | ||
| 28 | { | ||
| 29 | allArgs.AddRange(arguments); | ||
| 30 | } | ||
| 31 | |||
| 32 | switch (buildSystem) | ||
| 33 | { | ||
| 34 | case BuildSystem.MSBuild: | ||
| 35 | case BuildSystem.MSBuild64: | ||
| 36 | { | ||
| 37 | return MsbuildRunner.Execute(projectPath, allArgs.ToArray(), buildSystem == BuildSystem.MSBuild64); | ||
| 38 | } | ||
| 39 | default: | ||
| 40 | { | ||
| 41 | throw new NotImplementedException(); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||
| 46 | } | ||
