Skip to content

Visual studio update 17.14.0 i get an MSB4018 DiscoverPrecompreedAssets error #62142

Closed
@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


After updating to 17.14.0 i get this error

The “DiscoverPrecompressedAssets” task failed unexpectedly.
System.InvalidOperationException: File length for ‘C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\obj\dist_content\i18ntext\Mcc.Web.I18nText.AssemblyFunctionTable.AssemblyFunctionTable.dk.json’ is not defined.
at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.Validate()
at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.FromTaskItem(ITaskItem item)
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Buffer1…ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DiscoverPrecompressedAssets.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Nothing code vise has changed only thing i did is to update to 17.14.0 form 17.13.6 (where there were no issues)

So now i cant even compile my code


Original Comments

Ricardo Yánez on 5/14/2025, 06:03 PM:

(private comment, text removed)

Peter Hymøller on 5/15/2025, 06:33 AM:

I have found this on the Dotnet aspcore github where others are having the same issue

#59625 (comment)

it seams that i can be fix by reverting back to SDK 9.0.204 and then keeping Visual Studio on 17.14.0

Feedback Bot on 5/15/2025, 08:03 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

ravi on 5/15/2025, 02:01 PM:

This has been happening for me too. I added a global.json with the below contents to my project but I’m still hitting the error often. When is a fix expected to be released?

{  
    “sdk”: {  
    “version”: “9.0.204”,  
    “rollForward”: “disable”  
    }  
}

Javier Calvarro Nelson [MSFT] on 5/15/2025, 06:31 PM:

(private comment, text removed)

Peter Hymøller on 5/16/2025, 07:21 AM:

HI Javier

No removing bin and obj files does not resolve the issue

But as Ravi said reverting sdk to 9.0.204 and rollForward to disable fixes the issue, but it is a workaround to a permanent fix

Javier Calvarro Nelson [MSFT] on 5/16/2025, 08:45 AM:

Could attach binary logs from your build? In order to capture those, if you build from the command line with dotnet build /bl it will generate the logs. Alternatively, setup the following environment variables and, open visual studio and trigger a build.

$env:MSBUILDDEBUGENGINE = “1”
$env:MSBUILDDEBUGPATH = “c:\some\path”

Why do we ask for more info?
We try to reproduce all issues reported with the information provided in the description and comments. When we can’t reproduce the issue, we ask you for more information so we can resolve the issue as quickly and efficiently as possible.
In our guidelines, you can get tips on how to provide clear and simple reproducible steps.

Peter Hymøller on 5/16/2025, 08:52 AM:

logs after a build for command line:

  Mcc.Web failed with 1 error(s) and 25 warning(s) (14,3s)
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Equipment\Robotool\Robotool.razor(50,43): warning CS8629: Nullable value type may be null.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueItemsComponent.razor(10,28): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Support\SfcManagement\Components\Modals\ViewRespReqModalComponent.razor.cs(14,23): warning CS8618: Non-nullable property 'JsRuntime' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(10,98): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(12,98): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(14,71): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(18,98): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(20,98): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(22,98): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(41,58): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(44,58): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(49,63): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(57,58): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(60,58): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\SfcQueue\Components\SfcQueueDetailEditComponent.razor(63,81): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Configuration\Roboception\Components\RoboceptionPosesComponent.razor(43,107): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Information\LanePointOverview\Components\LanePointOverviewTableComponent.razor.cs(16,19): warning CS8618: Non-nullable field '_selectedLanePoints' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\MyStation\ManualWorkstation\ManualWorkstationScan.razor.cs(137,34): warning CS8625: Cannot convert null literal to non-nullable reference type.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\MyStation\ManualTest\ManualTestIcSmall.razor(43,14): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\OrderStart\OrderStart.razor(22,135): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\OrderStart\OrderStart.razor(22,135): warning CS8604: Possible null reference argument for parameter 'value' in 'void OrderStart.OnValueChanged(string value)'.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\MyStation\ReworkStation\ReworkPage.razor(31,40): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\MyStation\ReworkStation\ReworkPage.razor(31,85): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\ProductionFloor\MyStation\ManualTest\IcSmallManualTesterComponent.razor(54,18): warning CS8602: Dereference of a possibly null reference.
    C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\Pages\Configuration\Roboception\Components\RoboceptionHistoricalDetectionsComponent.razor.cs(14,76): warning BL0007: Component parameter 'Mcc.Web.Pages.Configuration.Roboception.Components.RoboceptionHistoricalDetectionsComponent.RoboceptionPartDetectionVmList' should be auto property
    C:\Program Files\dotnet\sdk\9.0.300\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets(289,5): error MSB4018:
      The "DiscoverPrecompressedAssets" task failed unexpectedly.
      System.InvalidOperationException: File length for 'C:\Users\U379141\source\repos\ModularConnectivityController\Source\Mcc.Web\obj\dist\_content\i18ntext\Mcc.Web.I18nText.AssemblyFuncti
      onTable.AssemblyFunctionTable.dk.json' is not defined.
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.Validate()
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.FromTaskItem(ITaskItem item)
         at System.Linq.Enumerable.ArraySelectIterator`2.ToArray()
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.DiscoverPrecompressedAssets.Execute()
         at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
         at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, Task
      ExecutionMode howToExecuteTask)

Build failed with 1 error(s) and 25 warning(s) in 29,3s

Peter Hymøller on 5/16/2025, 09:12 AM:

i see after running it here is the file generated
msbuild.binlog

Peter Hymøller on 5/16/2025, 00:30 PM:

Yes the error is in the SDK Package speseficlt 9.0.300

But in visual studio error list i get this “DiscoverPrecompressedAssets” witch is related to the SDK 9.0.300
if i install 9.0.204 and set a global.json file with

{
  "sdk": {
    "version": "9.0.204",
    "rollforward": "disable"
  }
}

to hardlock it back to 9.0.204 i can build again but this is a workaround, as something seams to break in 9.0.300

Just at a lot of other people (atleast 7 others plus my team (5 others to that)) have this same issue as i have with the SDK 9.0.300 see:
#59625 (comment)

and the following comments 😃
also where i got the workaround form in the first place

Javier Calvarro Nelson [MSFT] on 5/16/2025, 09:05 AM:

Thanks for the additional details.

If you built from the command line with dotnet build /bl, a file msbuild.binlog will be generated in the current folder. Could you attach that to the issue?

Javier Calvarro Nelson [MSFT] on 5/16/2025, 00:20 PM:

(private comment, text removed)

ravi on 5/16/2025, 01:19 PM:

Where exactly should the global.json file go? I had added it to the top-level of my asp.net app, but it doesn’t seem to work. Does it need to go somewhere under the bin or wwwroot folder?

Peter Hymøller on 5/16/2025, 01:26 PM:

You need to Add it to the Solution folder directly the VS will create a Solution Items folder where it lives
And make sure you have downloaded the SDK version you want to run (9.0.204)

image.png

https://dotnet.microsoft.com/en-us/download/dotnet/9.0


Original Solutions

J.Sakamoto solved on 5/22/2025, 03:47 PM, undefined votes:

Hi everyone,
It took a while, but I’ve finally fixed the build error on .NET SDK 9.0.300.

You can see the changes I made to the I18nText Blazor library here:

Please give it a try!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Author: Migration Bot 🤖The issue was created by a issue mover bot. The author may not be the actual author.ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions