Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

  • Understand the codebase structure - StaticWebAssetsSdk targets and tasks
  • Understand the existing test patterns in Microsoft.NET.Sdk.StaticWebAssets.Tests
  • Analyze the ResolveProjectStaticWebAssets target and DefineStaticWebAssets task
  • Add new AdditionalStaticWebAssetsBasePath property support
  • Create ParseAdditionalStaticWebAssetsBasePaths task to parse the property and discover files (replaced with MSBuild ItemGroup transforms per reviewer feedback)
  • Add ResolveAdditionalStaticWebAssets target that runs as part of ResolveCoreStaticWebAssets
  • Use MSBuild property functions to parse and split the property
  • Add E2E tests for build scenarios with additional content roots
  • Add E2E test for multiple content roots
  • Add E2E test for publish scenarios
  • All 3 new tests pass
  • Run code review and address comments
  • Run CodeQL security check
Original prompt

This section details on the original issue you should resolve

<issue_title>[StaticWebAssets] Provide the ability to pass additional assets via an MSBuild property at build/publish time</issue_title>
<issue_description>* The property will be a semicolon separated list of values where each value is a content root path, followed by a basepath and separated by comma.

  • For example `<>,<>;<>,<>.
  • We want to have a new target that runs at the same time as ResolveCurrentProjectStaticWebAssets and performs the same actions. Just with the set of provided content root base path pairs.
  • We need to add E2E tests for this at https://github.com/dotnet/sdk/tree/main/test/Microsoft.NET.Sdk.StaticWebAssets.Tests
  • Look at how is done in one of the static web assets baseline tests.
  • Use one of the assets from the existing testassets
    • add some folders outside of the project.
    • Run dotnet build passing the property (let's call it AdditionalContentRoots)
    • Validate that the assets are present in the generated manifests.
    • You can run the tests and inspect the manifest manually to make sure they work.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 4, 2025 19:32
…oots

- Add ParseAdditionalStaticWebAssetsBasePaths task to parse and discover files from additional content roots
- Add ResolveAdditionalStaticWebAssets target that runs as part of ResolveCoreStaticWebAssets
- Add UsingTask registration for the new task
- Add E2E tests for build and publish scenarios with additional content roots
- Support semicolon-separated list of content-root,base-path pairs

Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
- Use conditional compilation for EndsWith(char) and Path.GetRelativePath
- Add fallback implementations for .NET Framework 4.7.2

Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
Comment on lines 125 to 129
<UsingTask
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ParseAdditionalStaticWebAssetsBasePaths"
AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)"
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />

Copy link
Member

Choose a reason for hiding this comment

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

@copilot don't do this with a custom task.

Use an itemgroup with Include then from that item group, create a separate item group with a transform.

Something like

<ItemGroup>
  <MyItem Include="$(MyItems)">
    <Path>$([System.String]::Copy(%(Identity)).Split(',')[0])</Path>
    <BasePath>$([System.String]::Copy(%(Identity)).Split(',')[1])</BasePath>
  </MyItem>
</ItemGroup>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced the custom task with MSBuild ItemGroup transforms in 76775fb. The implementation now uses property functions to split the semicolon-separated list into items and extract ContentRoot/BasePath using Split(','), followed by a glob pattern to discover files.

Copilot AI changed the title [WIP] Add support for passing additional assets via MSBuild property Add AdditionalStaticWebAssetsBasePath property for external content roots Dec 4, 2025
Copilot AI requested a review from javiercn December 4, 2025 19:42
Copilot finished work on behalf of javiercn December 4, 2025 19:42
- Remove ParseAdditionalStaticWebAssetsBasePaths custom task
- Use MSBuild property functions to parse content-root,base-path pairs
- Use ItemGroup transforms to split and discover files from content roots

Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
@eerhardt
Copy link
Member

eerhardt commented Dec 5, 2025

@javiercn - what do you think about adding a ProjectCapability for this? That way from Aspire we can tell if the project supports this feature, and if so, use it. If it doesn't, we can do what we are currently doing for PublishAsContainerFiles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[StaticWebAssets] Provide the ability to pass additional assets via an MSBuild property at build/publish time

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.