Skip to content

specify the project file name when running dotnet publish to avoid issues when the folder contains a solution file#1170

Merged
sebastienros merged 1 commit intoaspnet:masterfrom
adamsitnik:performanceRepo
Aug 6, 2019
Merged

specify the project file name when running dotnet publish to avoid issues when the folder contains a solution file#1170
sebastienros merged 1 commit intoaspnet:masterfrom
adamsitnik:performanceRepo

Conversation

@adamsitnik
Copy link
Copy Markdown
Contributor

While building the performance culture in CoreFX I have noticed that most of the devs can now easily run the performance repo microbenchmarks on their machine, however very few run Linux vs Windows comparison.

@sebastienros has recently shown me how to run BenchmarkDotNet benchmarks using this amazing repository and infrastructure.

I think that it would be great if we could use it to quickly compare .NET Core performance on Linux vs Windows on the same hardware. Disclaimer: I don't want the entire CoreFX Team to start pushing a lot of jobs to the ASP.NET Perf infra, I just want to make it easy for the Team to measure the OS difference quickly when needed.

I have already introduced some changes to the performance repository to make it possible:

dotnet/performance#591
dotnet/performance#592
dotnet/performance#594

The last problem that remains active is addressed by this PR.

If we run dotnet publish in given folder without specifying the project name:

  • if the folder does not contain a .sln file, but a .csproj only, dotnet publish publishes only the .csproj (99.9% of the cases, worked for everyone so far)
  • if the folder contains a .sln file, dotnet publish tries to publish all projects in given solution, including test projects etc. This is the problem in the performance repo where we have a solution file and a project file in the same folder. dotnet publish tries to publish a self-contained version of xunit test project and it fails.

obraz

  "Command dotnet publish -c Release -o /tmp/BenchmarksServer/iprzluxi.olr/performance/src/benchmarks/micro/published /p:BenchmarksAspNetCoreVersion=3.0.0-preview7.19325.1 /p:MicrosoftAspNetCoreAllPackageVersion=3.0.0-preview7.19325.1 /p:MicrosoftAspNetCoreAppPackageVersion=3.0.0-preview7.19325.1 /p:BenchmarksNETStandardImplicitPackageVersion=3.0.0-preview7.19325.1 /p:BenchmarksNETCoreAppImplicitPackageVersion=3.0.0-preview7.19325.1 /p:BenchmarksRuntimeFrameworkVersion=3.0.0-preview7-27825-02 /p:BenchmarksTargetFramework=netcoreapp3.0 /p:MicrosoftNETCoreAppPackageVersion=3.0.0-preview7-27825-02 /p:NETCoreAppMaximumVersion=99.9 /p:MicrosoftNETCoreApp30PackageVersion=3.0.0-preview7-27825-02 /p:MicrosoftNETPlatformLibrary=Microsoft.NETCore.App --framework netcoreapp3.0 --self-contained -r linux-x64  returned exit code 1 
Microsoft (R) Build Engine version 16.3.0-preview-19321-02+a5a222491 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 498.44 ms for /tmp/BenchmarksServer/iprzluxi.olr/performance/src/tools/Reporting/Reporting/Reporting.csproj.
  Restore completed in 689.74 ms for /tmp/BenchmarksServer/iprzluxi.olr/performance/src/harness/BenchmarkDotNet.Extensions/BenchmarkDotNet.Extensions.csproj.
  Restore completed in 1.33 sec for /tmp/BenchmarksServer/iprzluxi.olr/performance/src/benchmarks/micro/MicroBenchmarks.csproj.
  Restore completed in 1.46 sec for /tmp/BenchmarksServer/iprzluxi.olr/performance/src/tests/harness/BenchmarkDotNet.Extensions.Tests/BenchmarkDotNet.Extensions.Tests.csproj.
  Reporting -> /tmp/BenchmarksServer/iprzluxi.olr/performance/artifacts/bin/Reporting/Debug/netcoreapp3.0/Reporting.dll
  BenchmarkDotNet.Extensions -> /tmp/BenchmarksServer/iprzluxi.olr/performance/artifacts/bin/BenchmarkDotNet.Extensions/Release/netcoreapp3.0/linux-x64/BenchmarkDotNet.Extensions.dll
  BenchmarkDotNet.Extensions -> /tmp/BenchmarksServer/iprzluxi.olr/performance/src/benchmarks/micro/published/
  BenchmarkDotNet.Extensions -> /tmp/BenchmarksServer/iprzluxi.olr/performance/artifacts/bin/BenchmarkDotNet.Extensions/Release/netcoreapp3.0/BenchmarkDotNet.Extensions.dll
  MicroBenchmarks -> /tmp/BenchmarksServer/iprzluxi.olr/performance/artifacts/bin/MicroBenchmarks/Release/netcoreapp3.0/linux-x64/MicroBenchmarks.dll
  MicroBenchmarks -> /tmp/BenchmarksServer/iprzluxi.olr/performance/src/benchmarks/micro/published/
/tmp/BenchmarksServer/qt1c15ni.vyi/sdk/3.0.100-preview7-012605/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(131,5): error NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true. [/tmp/BenchmarksServer/iprzluxi.olr/performance/src/tests/harness/BenchmarkDotNet.Extensions.Tests/BenchmarkDotNet.Extensions.Tests.csproj]

The solution is to provide the project name when doing dotnet publish $projectName.

This should not be an issue, because this particular command expects user to provide the path via --project-file when running BenchmarkDriver. It's already used to get the WorkingDirectory for dotnet publish

// Computes the location of the benchmarked app
var benchmarkedApp = Path.Combine(path, benchmarkedDir, Path.GetDirectoryName(FormatPathSeparators(job.Source.Project)));

var buildResults = ProcessUtil.Run(dotnetExecutable, arguments,
workingDirectory: benchmarkedApp,

…sues when a folder contains a project and solution

in such case, without the project file name specified entire solution is published and in case of the performance repo, fails
@sebastienros sebastienros merged commit ff32ba3 into aspnet:master Aug 6, 2019
@adamsitnik adamsitnik deleted the performanceRepo branch August 6, 2019 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants