Skip to content

Missing Priority metadata on StaticWebAssetContentTypeMapping example #36575

@guardrex

Description

@guardrex

Description

Reported at dotnet/aspnetcore#63698 (comment).

Thanks @stasberkov ... I opened this doc issue from the bottom of the article (Open a documentation issue link/form) and referenced the PU issue.

I believe doc was provided here https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-10.0&source=docs#msbuild-properties but it contains error. If using as described, e.g.

<ItemGroup>
  <StaticWebAssetContentTypeMapping Include="application/yaml" Cache="no-cache" Pattern="*.yaml" />
</ItemGroup>

you will get wired error like

  web net10.0 failed with 1 error(s) (0.1s)
    C:\Program Files\dotnet\sdk\10.0.101\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.targets(732,5): error MSB4018:
      The "DefineStaticWebAssetEndpoints" task failed unexpectedly.
      System.FormatException: The input string '' was not in a correct format.
         at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
         at System.Int32.Parse(String s, IFormatProvider provider)
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.ContentTypeMapping.FromTaskItem(ITaskItem contentTypeMappings)
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssetEndpoints.CreateAdditionalContentTypeMappings()
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssetEndpoints.Execute()
         at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Build failed with 1 error(s) in 1.6s

To avoid this error, you must specify Priority field like

<ItemGroup>
  <StaticWebAssetContentTypeMapping Include="application/yaml" Cache="no-cache" Pattern="*.yaml" Priority="2" />
</ItemGroup>

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-10.0&source=docs#msbuild-properties

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/static-files.md

Document ID

3fec6e08-fc99-7a5c-796f-3f2347cad891

Platform Id

5c42c2c8-be1b-60de-8cde-f9b8d8c24f5f

Article author

@wadepickett

Metadata

  • ID: d47f38e2-bc36-cfb8-b0cc-17a534689f8b
  • PlatformId: 5c42c2c8-be1b-60de-8cde-f9b8d8c24f5f
  • Service: aspnet-core
  • Sub-service: fundamentals

Related Issues

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions