示例#1
0
文件: Program.cs 项目: asklar/CsWinRT
            public CustomConfig()
            {
                // Test CsWinRT projection
                var job = Job.Default
                          .WithPlatform(BenchmarkDotNet.Environments.Platform.X64)
                          .WithArguments(
                    new Argument[] {
                    new MsBuildArgument("/p:platform=x64"),
                    new MsBuildArgument("/p:IsDotnetBuild=true")
                }
                    ).AsDefault();

                // Test WinMD support
#if NETCOREAPP3_1
                // BenchmarkDotNet will rebuild the project with a project reference to this project when this project's output exe is ran.  It
                // will be ran from the same folder as where we have the application manifest binplaced which we want to embed in the new exe.
                string manifestFile = Path.Combine(
                    Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
                    "Benchmarks.manifest");

                var winmdJob = Job.Default
                               .WithPlatform(BenchmarkDotNet.Environments.Platform.X64)
                               .WithToolchain(new NetCore3ToolChainWithNativeExecution())
                               .WithArguments(
                    new Argument[] {
                    new MsBuildArgument("/p:platform=x64"),
                    new MsBuildArgument("/p:ApplicationManifest=" + manifestFile),
                    new MsBuildArgument("/p:BenchmarkWinmdSupport=true"),
                    new MsBuildArgument("/p:IsDotnetBuild=true")
                }
                    )
                               .WithId("WinMD NetCoreApp31");

                // Optimizer needs to be diabled as it errors on WinMDs
                Config = Config.WithOption(ConfigOptions.DisableOptimizationsValidator, true)
                         .AddJob(winmdJob);
#else
                Config = Config.AddJob(job);
#endif
            }