Skip to content

Commit

Permalink
[templates] use copyOnly for certain files
Browse files Browse the repository at this point in the history
Context: dotnet/templating#3325
Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation

In current .NET 6 Preview 6 builds, there is an issue if a template
includes a binary file larger than ~8kb, it seems to get truncated when
`dotnet new` extracts the template.

A workaround is to use the `copyOnly` feature for binary files. Really,
we should be doing this anyway, because otherwise the templating system
considers replacing *text* in these binary files. It improves
performance to do this and would hopefully prevent a future bug of
random bytes getting replaced.

For .NET MAUI, the following files need `copyOnly`:

* `wwwroot/css` folder has several types of  fonts inside
* `.svg` and `.ttf` files
  • Loading branch information
jonathanpeppers committed Jun 25, 2021
1 parent d7e0e9a commit a7b7c7d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
"type": "solution"
},
"sourceName": "MauiApp1",
"sources": [
{
"source": "./",
"target": "./",
"copyOnly": [ "**/wwwroot/css/**", "**/*.svg", "**/*.ttf" ]
}
],
"preferNameDirectory": true,
"primaryOutputs": [
{ "path": "MauiApp1/MauiApp1.csproj" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
"type": "solution"
},
"sourceName": "MauiApp1",
"sources": [
{
"source": "./",
"target": "./",
"copyOnly": [ "**/*.svg", "**/*.ttf" ]
}
],
"preferNameDirectory": true,
"guids": [
"07CD65EF-6238-4365-AF5D-F6D433967F48",
Expand Down

0 comments on commit a7b7c7d

Please sign in to comment.