-
Notifications
You must be signed in to change notification settings - Fork 10.3k
dotnet publish --no-build
over-publishes from referenced projects
#43835
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
Comments
- building again in Publish target adds nothing in most cases - use `-noBuildRepoTasks` more consistently - again, building the repo tasks wastefully repeated work done in previous build step - use `-noBuildJava` more consistently in quarantined pipelines - Java tests aren't worth testing _or building_ in these pipelines because they cannot be quarantined - remove `-noRestore` and `-noBuildDeps` when `-noBuild` specified; redundant - work around https://github.com/dotnet/sdk/issues/23777 - do not publish .cshtml files of most test asset projects when `$(NoBuild)` is set - update FunctionalTestWithAssets.targets to help Publish succeed when `$(NoBuild)` is set - fixes build jobs in quarantined-pr pipeline where `--no-build` was already specified - for IIS test assets, perform all builds needed for their profiles within Build target - move `ReferenceTestTasks=false` and comments about it to where property matters - merge separate targets in FunctionalTest.props to make items available during (now separate) Publish nits: - touch up RunHelix.ps1 console output - reorder command line arguments for consistency in changed parts of the YAML files - move `NoBuild=true` setting out of FunctionalTestWithAssets.props - use `BeforeTargets` in FunctionalTest.props to improve determinism
* Use `-noBuild` in second build steps of test jobs - building again in Publish target adds nothing in most cases - use `-noBuildRepoTasks` more consistently - again, building the repo tasks wastefully repeated work done in previous build step - use `-noBuildJava` more consistently in quarantined pipelines - Java tests aren't worth testing _or building_ in these pipelines because they cannot be quarantined - remove `-noRestore` and `-noBuildDeps` when `-noBuild` specified; redundant - work around https://github.com/dotnet/sdk/issues/23777 - do not publish .cshtml files of most test asset projects when `$(NoBuild)` is set - update FunctionalTestWithAssets.targets to help Publish succeed when `$(NoBuild)` is set - fixes build jobs in quarantined-pr pipeline where `--no-build` was already specified - for IIS test assets, perform all builds needed for their profiles within Build target - move `ReferenceTestTasks=false` and comments about it to where property matters - merge separate targets in FunctionalTest.props to make items available during (now separate) Publish nits: - touch up RunHelix.ps1 console output - reorder command line arguments for consistency in changed parts of the YAML files - move `NoBuild=true` setting out of FunctionalTestWithAssets.props - use `BeforeTargets` in FunctionalTest.props to improve determinism
Here's a standalone repro projects (and binlogs in the RazorPages project directory): RazorOverPublish23777.zip During a normal build, However, when using To fix this, probably the /cc @captainsafia, @pranavkm, @mkArtakMSFT as Razor SDK area owners. |
Thanks for contacting us. We're moving this issue to the |
@dougbu why is this important? Can we just not do this work or is there a push to get this resolved? so far we've seen no customer impact from this. |
@mkArtakMSFT this issue is important because
|
Describe the bug
The Web SDK does not normally publish
*.cshtml
files when usingdotnet publish
(because they're precompiled into the web site assembly and aren't needed). These files are published from referenced projects if$(NoBuild)
istrue
e.g. usingdotnet publish --no-build
. These files increase deployment payloads and can confuse tests.To Reproduce
eng\build.cmd -noBuildManaged -noBuildNative
dotnet build src\Mvc\test\WebSites\RazorPagesWebSite\
dotnet publish --no-build src\Mvc\test\WebSites\RazorPagesWebSite\
*.cshtml
files within itrm -Recurse artifacts\bin\RazorPagesWebSite\
andrm -Recurse artifacts\obj\RazorPagesWebSite\
dotnet build src\Mvc\test\WebSites\RazorPagesWebSite\
dotnet publish src\Mvc\test\WebSites\RazorPagesWebSite\
More detail
Using
/p:BuildProjectReferences=false
instead of--no-build
in step 3 results in the same over-publication.The ClassLibraryPages folder comes from the referenced src\Mvc\test\WebSites\RazorPagesClassLibrary\ project. Note the many
*.cshtml
files from the RazorPagesWebSite project are not published in either (3) or (7).Moving up a project dependency level and doing the same with the src\Mvc\test\Mvc.FunctionalTests\ project is worse because src\Mvc\test\WebSites\RazorPagesWebSite\ contains a lot of
*.cshtml
files and other referenced projects add to that; all are copied into artifacts\bin\Microsoft.AspNetCore.Mvc.FunctionalTests\Debug\net7.0\publish\Pages and …\Views. This breaks the functional tests because a few test sites use<RazorCompileOnPublish>false</RazorCompileOnPublish>
and pick up incorrect / unexpected files.Binary logging
The
AssignTargetPaths
target in the RazorPagesClassLibrary project adds@(ContentWithTargetPath)
forPages\ClassLibraryPages\*.cshtml
in all cases. The items are removed before theGetCopyToPublishDirectoryItems
target is reached but not when using--no-build
or/p:BuildProjectReferences=false
. It's not clear where the removals happen because item removals are not consistently logged.Versions
I've only tested with the
7.0.100-preview.2.22102.6
SDK but this is likely a long-standing issue.dotnet details
The text was updated successfully, but these errors were encountered: