Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Publish target on a consuming project does not include assets in .playwright folder #2582

Open
arpavan opened this issue May 19, 2023 · 1 comment

Comments

@arpavan
Copy link

arpavan commented May 19, 2023

Context

  • Playwright Version: 1.22.0
  • Operating System: Cross-Platform
  • .NET version: .NET 4.8, .NET 6
  • Browser: N/A

Description
We've observed that when we consume the Playwright NuGet package in our project and build it, the included assets in the .playwright folder are copied over to the build output. However in a subsequent publish step, the playwright DLLs are included but the assets in the .playwright folder are missed out. This is leading to our final application distributable package missing these assets and therefore breaking functionality.

We believe this is happening because in Microsoft.Playwright.targets the CopyPlaywrightFilesToOutput target has been set to execute before a build step (i.e. AfterTargets="BeforeBuild"), and hence this target does not execute during publish. In our internal tests, setting this target to execute at a different point seems to help i.e. executes at the publish step as well. Our test - <Target Name="CopyPlaywrightFilesToOutput" AfterTargets="AssignTargetPaths">.

@joem-msft
Copy link

I helped Pavan with analyzing this issue to come up with a fix.

One important condition in our build process is that we essentially do:

  1. dotnet restore
  2. dotnet build --no-restore
  3. Sign dlls using a build task outside of MSBuild
  4. dotnet publish -f net48 --no-restore --no-build
  5. dotnet publish -f net6.0 --no-restore --no-build

It's during the 'publish' with --no-build that this situation occurs.

Whenever dynamically adding Content/None items to a project, I've found that the safest time to do it is before the AssignTargetPaths target executes. This target is a dependency of Build, Publish and Pack targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants