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

[dotnet-sdk-9.0.100-preview.7.24353.17] The "ResolvedCompressedAssessts" task failed unexpectedly. #56664

Closed
1 task done
Junjun-zhao opened this issue Jul 8, 2024 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components External This is an issue in a component not contained in this repository. It is open for tracking purposes. ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved

Comments

@Junjun-zhao
Copy link
Member

Junjun-zhao commented Jul 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Description:
When retarget the 3rd party application to net9.0 with the latest .NET 9 build, it failed to build with error MSB4018: The "ResolveCompressedAssets" task failed unexpectedly.

Expected Behavior

Application Name: WorldExplorer
OS: Windows10 21h2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.7.24353.17
App Source or App Installer checking at:
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2133589

Github Link:
https://github.com/VladislavAntonyuk/WorldExplorer

Verify Scenarios:
1.Windows 10 21H2 AMD64 + dotnet-sdk-8.0.301: Pass
2.Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.5.24277.8: Fail
3.Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.6.24314.10: Fail
4.Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.7.24353.17: Fail

Steps To Reproduce

WorldExplorer App Test Steps:
The machine has dotnet-sdk-9.0.100-preview.7.24353.17 sdk installed.
1.Open command prompt window and navigate to src\WebApp\ folder.
2. Run "dotnet new globaljson" command. It will generate a global.json file with 9.0.100-preview.7.24353.17 sdk version assigned.
3. dotnet build WebApp.csproj

Expected Result:
Build successfully.

Minimal Repro steps (Demo attached): ResolvedCompressedAssesstsDemo.zip

1.Create a .NET 8.0 Blazor web app project.
2. Install Toolbelt.Blazor.I18nText (version 12.0.2) nuget package.
3. Registry the I18nText service in Program.cs file:

using BlazorApp1.Components;
using Toolbelt.Blazor.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddI18nText();
  1. Create a folder named "i18ntextRun"
  2. Create a file named "Translation.en.json" under "i18ntext" folder with below content:
{
"DangerZone": "Danger Zone"
}
  1. Set the Build Action for Translation.en.json file as "C# analyzer additional file".
  2. Run "dotnet new globaljson" command. It will generate a global.json file with 9.0.100-preview.7.24353.17 sdk version assigned.
  3. Build the project.

Expected Result:
Build successfully.

Exceptions (if any)

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)	MSB4018	The "ResolveCompressedAssets" task failed unexpectedly.
System.InvalidOperationException: Fingerprint for 'E:\Demos\ResolvedCompressedAssesstsDemo\BlazorApp1\obj\Debug\net8.0\dist\_content\i18ntext\BlazorApp1.I18nText.Translation.en.json' is not defined.
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.Validate()
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.FromTaskItem(ITaskItem item)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.ResolveCompressedAssets.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	BlazorApp1	C:\Program Files\dotnet\sdk\9.0.100-preview.7.24353.17\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets	280		

.NET Version

dotnet-sdk-9.0.100-preview.7.24353.17

Anything else?

Findings:
This issue started from dotnet-sdk-9.0.100-preview.5.24277.8. We filed it in #56288 and there is a fix for the bug. But that only fix QuickApp app, WorldExplorer app still have this issue.

Dotnet Info:

.NET SDK:
 Version:           9.0.100-preview.7.24353.17
 Commit:            3e3bec0dc6
 Workload version:  9.0.100-manifests.85e1728a
 MSBuild version:   17.12.0-preview-24353-01+a481b831d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100-preview.7.24353.17\

Host:
  Version:      9.0.0-preview.7.24352.15
  Architecture: x64
  Commit:       static
  RID:          win-x64

.NET SDKs installed:
  9.0.100-preview.7.24353.17 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.7.24329.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.7.24352.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 9.0.0-preview.7.24353.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@dotnet-actwx-bot @dotnet/compat

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Jul 8, 2024
@javiercn
Copy link
Member

javiercn commented Jul 8, 2024

@Junjun-zhao thanks for contacting us.

This seems to be an issue with one of the libraries being used Toolbelt.Blazor.I18nText which seems to be incorrectly integrating with our static web assets feature. Instead of directly defining the assets, the recommended approach is to generate the content before AssignTargetPaths and before ResolveProjectStaticWebAssets runs and defining Content items either on the wwwroot folder directly or using the TargetPath property pointing to the location on the wwwroot folder instead of directly defining the assets like they are doing right now.

  <!-- FOR SUPPORT TO .NET 6 or later Razor SDK - NEW STATIC WEB ASSETS ARCHITECTURE -->

  <Target Name="_ResolveBlazorI18nTextStaticWebAssets" Condition=" $(I18nTextNewStaticWebAssetsArchitecture) " DependsOnTargets="_IncludeGeneratedI18nTextResourceJsons">
    <ItemGroup>
      <_BlazorI18nTextStaticWebAsset Include="@(ContentWithTargetPath)" Condition="$([System.String]::Copy('%(TargetPath)').Replace('/','\').StartsWith('wwwroot\_content\i18ntext\'))" />
      <StaticWebAsset Include="@(_BlazorI18nTextStaticWebAsset)">
        <SourceType>Computed</SourceType>
        <SourceId>$(PackageId)</SourceId>
        <ContentRoot>%(RelativeDir)</ContentRoot>
        <BasePath>/</BasePath>
        <RelativePath>_content/i18ntext/%(FileName)%(Extension)</RelativePath>
        <OriginalItemSpec>%(FullPath)</OriginalItemSpec>
        <AssetKind>All</AssetKind>
        <AssetMode>All</AssetMode>
        <AssetRole>Primary</AssetRole>
      </StaticWebAsset>
    </ItemGroup>
  </Target>

  <Target Name="_RemoveBlazorI18nTextStaticWebAssetsFromPackage" Condition=" $(I18nTextNewStaticWebAssetsArchitecture) " DependsOnTargets="_IncludeGeneratedI18nTextResourceJsons">
    <ItemGroup>
      <StaticWebAsset Remove="@(StaticWebAsset)" Condition="$([System.String]::Copy('%(RelativePath)').Replace('/','\').StartsWith('_content\i18ntext\'))"/>
    </ItemGroup>
  </Target>

@javiercn
Copy link
Member

javiercn commented Jul 8, 2024

Filed jsakamoto/Toolbelt.Blazor.I18nText#63 on the library, but this is by design. Libraries should integrate by providing Content items instead of directly generating static web assets.

@javiercn javiercn added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Jul 8, 2024
@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. label Jul 8, 2024
@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
@jsakamoto
Copy link

@javiercn OK, I'll fix the "I18nText" library on my side, following your advice. Thank you for explaining that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components External This is an issue in a component not contained in this repository. It is open for tracking purposes. ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

4 participants