-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute property to WasmSdk #49994
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
Conversation
…y to WasmSdk Co-authored-by: ilonatommy <[email protected]>
StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute
for wasm apps is not emptyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a build failure in web applications that reference Sdk.WebAssembly projects by adding a missing property to the WasmSdk. The error "The UpdateExternallyDefinedStaticWebAssets task failed unexpectedly" occurred because the WasmSdk lacked a property that was already present in the BlazorWebAssembly SDK.
- Adds
StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute
property to WasmSdk - Ensures consistency between WasmSdk and BlazorWebAssembly SDK implementations
- Includes conditional check to avoid overriding user-defined values
Comments suppressed due to low confidence (1)
src/WasmSdk/Sdk/Sdk.props:29
- This property addition should include test coverage to verify that it resolves the build failure when web applications reference Sdk.WebAssembly projects. Consider adding a test that validates the property is set correctly and that the UpdateExternallyDefinedStaticWebAssets task succeeds.
<StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute Condition="'$(StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute)' == ''">true</StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute>
There are more defaults. Should we use them all ? sdk/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.props Lines 28 to 34 in a6d225e
|
Good question. Edit: Props that do not look blazor-specific and are not set, neither in sdk nor in runtime:
I would wait for @maraf with the decision. |
<!-- Static web assets defaults --> | ||
<StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute Condition="'$(StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute)' == ''">true</StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are similar properties in the Blazor WebAssembly SDK, we should remove them from there since that SDK imports this SDK and they are no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot fix it
No, we don't care about the remaining defaults, they are Blazor specific |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move the setting to https://github.com/dotnet/runtime/blob/main/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.props#L32-L39 if having the property set only after the nuget packages are restored is early enough
It should be |
This PR fixes an issue where web applications referencing Sdk.WebAssembly projects fail to build with the error "The UpdateExternallyDefinedStaticWebAssets task failed unexpectedly". The error occurs because the WasmSdk was missing the
StaticWebAssetMakeReferencedAssetOriginalItemSpecAbsolute
property that is already present in the BlazorWebAssembly SDK.The fix adds the missing property to
/src/WasmSdk/Sdk/Sdk.props
:This ensures consistency between the WasmSdk and BlazorWebAssembly SDK implementations and allows static web assets to resolve file paths correctly when processing externally defined assets.
The property includes a conditional check to avoid overriding any user-defined values, following the same pattern used in the BlazorWebAssembly SDK.
Fixes dotnet/runtime#118393, dotnet/aspnetcore#62915
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.