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

[templates] use copyOnly for certain files #1462

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

jonathanpeppers
Copy link
Member

Description of Change

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

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

No

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
{
"source": "./",
"target": "./",
"copyOnly": [ "**/wwwroot/css/**", "**/*.svg", "**/*.ttf" ]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eilon let me know if you see anything else in the maui-blazor template that needs this.

Related: dotnet/aspnetcore#33808

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this got everything.

@mattleibow mattleibow merged commit 6c51b60 into dotnet:main Jun 28, 2021
@jonathanpeppers jonathanpeppers deleted the template-copyonly branch June 29, 2021 01:03
@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2023
@samhouts samhouts added the fixed-in-6.0.100-preview.6 Look for this fix in 6.0.100-preview.6! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.100-preview.6 Look for this fix in 6.0.100-preview.6!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants