-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
StaticWebAssets.targets: Fix dotnet/runtime
+preview7 builds
#19578
Conversation
`dotnet/runtime` builds fail using preview7(`6.0.100-preview.7.21379.14`) with: ``` /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/radical/dev/r3/artifacts/obj/mono/BrowserDebugHost/Release/net6.0/StaticWebAssets.build.json'. [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) in System.Private.CoreLib.dll:token 0x60000d6+0x0 [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in System.Private.CoreLib.dll:token 0x60000da+0x31 [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : at System.IO.File.WriteAllBytes(String path, Byte[] bytes) in System.Private.CoreLib.dll:token 0x6005cce+0x2b [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : at Microsoft.AspNetCore.Razor.Tasks.GenerateStaticWebAssetsManifest.PersistManifest(StaticWebAssetsManifest manifest) in Microsoft.NET.Sdk.Razor.Tasks.dll:token 0x600018a+0x3b [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : at Microsoft.AspNetCore.Razor.Tasks.GenerateStaticWebAssetsManifest.Execute() in Microsoft.NET.Sdk.Razor.Tasks.dll:token 0x6000187+0xeb [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : Could not find a part of the path '/Users/radical/dev/r3/artifacts/obj/mono/BrowserDebugHost/Release/net6.0/StaticWebAssets.build.json'. [/Users/radical/dev/r3/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj] ``` Specifically, the `BrowserDebugHost` project fails: `.../Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/radical/dev/r3/artifacts/obj/mono/BrowserDebugHost/Release/net6.0/StaticWebAssets.build.json'` And this is failing because it is building `$(StaticWebAssetBuildManifestPath)` using `$(BaseIntermediateOutputPath)`. But for mono builds, the intermediate output paths are changed, in `src/mono/Directory.Build.props`. But the targets are assuming that the constructed path: `<_StaticWebAssetsManifestBase>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</_StaticWebAssetsManifestBase>` .. would have already been created. But since that gets changed for mono builds, the path being used here never gets created. And so it fails with: `System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/radical/dev/r3/artifacts/obj/mono/BrowserDebugHost/Release/net6.0/StaticWebAssets.build.json'` Note that other paths, like `$(_StaticWebAssetsIntermediateOutputPath)` are built using `$(IntermediateOutputPath)`, which correctly gets created, so that, and others in the same targets file are not affected. This change was added in: ``` commit 9ed247b Author: Javier Calvarro Nelson <jacalvar@microsoft.com> Date: Thu Jul 15 20:48:36 2021 +0200 [ASP.NET Core] Static web assets improvements (dotnet#18871) ```
@radical thanks for submitting the fix and the detailed explanation. I need to think a bit about it, the change that we did was intentional because using the intermediate output path didn't work in some cases that involved the Would an alternative be to ensure that the directory is created? The main issue is that the manifest is put in a place (obj\Debug\net6) as part of the build (there's no rid) and when publish happens it tries to read it from (obj\Debug\net6<>) as there is a rid defined for it. We always want the manifest to appear in (obj{Configuration}{targetframework}) |
AFAIU, yeah. Could you also try to build |
@radical If you need to get unblocked right away, I suggest you set |
@javiercn can this be closed now? |
I believe so |
dotnet/runtime
builds fail using preview7(6.0.100-preview.7.21379.14
) with:Specifically, the
BrowserDebugHost
project fails:.../Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(425,5): error : System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/radical/dev/r3/artifacts/obj/mono/BrowserDebugHost/Release/net6.0/StaticWebAssets.build.json'
And this is failing because it is building
$(StaticWebAssetBuildManifestPath)
using$(BaseIntermediateOutputPath)
. But for mono builds, the intermediateoutput paths are changed, in
src/mono/Directory.Build.props
.But the targets are assuming that the constructed path:
<_StaticWebAssetsManifestBase>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</_StaticWebAssetsManifestBase>
.. would have already been created. But since that gets changed for mono
builds, the path being used here never gets created. And so it fails
with:
System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/radical/dev/r3/artifacts/obj/mono/BrowserDebugHost/Release/net6.0/StaticWebAssets.build.json'
Note that other paths, like
$(_StaticWebAssetsIntermediateOutputPath)
are built using
$(IntermediateOutputPath)
, which correctly getscreated, so that, and others in the same targets file are not affected.
This change was added in: