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

Document publish output settings #18145

Closed
gewarren opened this issue Apr 28, 2020 · 0 comments · Fixed by #22257
Closed

Document publish output settings #18145

gewarren opened this issue Apr 28, 2020 · 0 comments · Fixed by #22257
Assignees
Labels
doc-enhancement Improve the current content [org][type][category]

Comments

@gewarren
Copy link
Contributor

gewarren commented Apr 28, 2020

Extracted from #2642:

  • How do I include or exclude files in/from the publish output?
    • Show <None Update="**/my_pattern/**" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" /> - https://stackoverflow.com/questions/44374074/copy-files-to-output-directory-using-csproj-dotnetcore/44378406#44378406
    • Note that CopyToPublishDirectory is an addition to the SDK-based projects.
    • Note that PreserveNewest should be preferred over Always since latter to be able to build incrementally (-> build time).
    • Explain that web projects may Content instead of None for certain paths and patterns.
      • currently this is everything in wwwroot\**, .json and .config files.
    • Show how to use LinkBase to include content from outside the project folder in a different subdirectory.
      • e.g. <Content Include="../shared-configs/**" LinkBase="config/" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />

See dotnet/msbuild#2795 and dotnet/sdk#1246 for info about Link and LinkBase.

Also:

Every item will need a Link metadata or else the AssignTargetPath of msbuild will not be able to determine a target path to copy it to (= ""outside of the project cone"").
The 2.0 SDK introduced LinkBase to help set a sensible Link metadata for items created through globbing. It's just a shortcut for Link="wwwroot\%(RecursiveDir)%(Filename)%(Extension)".


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Apr 28, 2020
@gewarren gewarren self-assigned this Apr 28, 2020
@gewarren gewarren added 📚 Area - .NET Core Guide doc-enhancement Improve the current content [org][type][category] and removed ⌚ Not Triaged Not triaged labels Apr 28, 2020
@gewarren gewarren changed the title Document Link and LinkBase Document publish output settings Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Improve the current content [org][type][category]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants