-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Intermittent Error on Build #57147
Comments
@javiercn FYI |
@halter73 this likely means the file is being added/deleted as part of the build process at the wrong time, hence sometimes its there, sometimes it isn't. |
This is happening to me too.
Edit: looks like VS was not compiling ts -> js files. Seems to be fixed now. |
This started happening to me as well after .NET 9 was released. I upgraded to Visual Studio 2022 v17.12.0, and tried compiling a .NET 8 ASP.NET MVC Core project (which started being compiled by the latest .NET 9 SDK):
Workaround:
|
This solution works! As long as the right SDK is installed on the system :-) Thanks |
I can confirm this happening again after VS 17.12 update. @drmcclelland solution fixed. |
Still an issue with VS 17.12.2 |
Hitting this with VS Version 17.12.3 |
Still an issue with VS 17.12.3 |
The issue is not resolved, still happens in VS 17.12.3. Started after installing .net 9 SDK as others mentioned. |
Just updated VS from 17.11.x to 17.12.3 and now running into this as well (and there's nothing intermittent about it). The solution did not work initially. "Unable to resolve the .NET SDK version as specified in the global.json located at \global.json". Installed the 8.0.404 sdk and it's now working. Is there an easy way to just roll back VS to an unbroken version? Workarounds and hacks have a tendency to get buried and lost and become like stray cats that never leave. |
Reproducing it intermittently with latest .NET 9 SDK 9.0.101 and I think I understood what causes it. In my scenario the exception is thrown during execution of a MSBuild task in a MSBuild project file. The project file is started from console - not using Visual Studio at all. The exception is thrown when bundling and minifying a bunch of .js files using the BuildBundlerMinifier package. The exception is thrown every second time when executing the MSBuild task. So it passes one time, then fails next time, then passes again third time and so on. The problem on my end seems to be caused by the contents of the .\wwwroot\js\bundles folder where the bundled assets are copied after processing the BundlerMinifier.BundlerBuildTask. If the .\wwwroot\js\bundles folder is not empty when the build is started, the build fails when it gets to the ResolveProjectStaticWebAssets task:
The strange thing is that the .\wwwroot\js\bundles folder gets cleaned even when the build has failed - that's why it passes the next time I started it. So in my scenario the workaround is to manually delete the folder .\wwwroot\js\bundles folder before starting the build. Hope this helps. |
I am using webpack 5 and had the same error with bundled files. I added a dependency on ResolveBuildRelatedStaticWebAssets by looking through the targets in the source: This is my csproj and now it works for the time being. It'll likely be broken when they get around to fixing this bug:
|
Same issue exists in VS 17.12.3 using .Net SDK 9.0.101, the exception is thrown when bundling and minifying a bunch of .js files using the BuildBundlerMinifier package as @ighristov mentioned. Workaround is to manually delete the folders everytime before build. |
I just discovered that the problem happens consistently if I "rebuild" the solution. It does not happen if I just build the solution. That's a workaround of sorts... |
I found a solution here Set PrepareForBuildDependsOn as following:
|
The same issue after updating to latest VS 2022 (17.12.3). And solution with sdk version in global.json doesn't work for me. It's ignored. |
The solution @Scanixx linked to on the VS Developer Community site worked for me without so much as a restart. Simply pasted that snippet into my web project, saved it and off we went, rebuilding happily. |
There's something weird going on. WebCompileClean happens during the rebuild which means there's no .css file (hence the error). After the rebuild errors, the .css file is created again through some binding (maybe the WebCompiler VS extension), so it looks like it always existed. If you watch the the .css file in the file explorer closely, you'll see it momentarily disappear (cleaned and then created). |
None of the solutions in this thread helped me. Here's the evil incantation I came up with. Maybe it will help you. Maybe it will not. <Target Name="PreResolveProjectStaticWebAssets" BeforeTargets="ResolveProjectStaticWebAssets">
<ItemGroup>
<StashedContent Include="@(Content)" />
<Content Remove="@(Content)" />
</ItemGroup>
</Target>
<Target Name="PostResolveProjectStaticWebAssets" AfterTargets="ResolveProjectStaticWebAssets">
<ItemGroup>
<Content Include="@(StashedContent)" />
</ItemGroup>
</Target> |
This issue has been moved from a ticket on Developer Community.
[severity:It's more difficult to complete my work]
I am getting an intermittent error on building my solution and the error states that a sepcific css file is missing but when i check it does exist on disk. The following is the error in the Error Window of Visual Studio...
Severity Code Description Project File Line Suppression State Details
Error (active) System.InvalidOperationException: No file exists for the asset at either location 'wwwroot\css\dx-reporting-skeleton-screen.css' or 'wwwroot\css\dx-reporting-skeleton-screen.css'.
at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, String originalItemSpec)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute() Opg.Business.Web.Ui.Realty.Portal C:\Program Files\dotnet\sdk\9.0.100-preview.5.24307.3\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.targets 597
Original Comments
Feedback Bot on 7/24/2024, 07:06 PM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: