|
9 | 9 | <RootNamespace>Verso.Cli</RootNamespace> |
10 | 10 | <PackAsTool>true</PackAsTool> |
11 | 11 | <ToolCommandName>verso</ToolCommandName> |
12 | | - <RollForward>LatestMajor</RollForward> |
| 12 | + <RollForward>Major</RollForward> |
13 | 13 | <PackageId>Verso.Cli</PackageId> |
14 | 14 | <PackageDescription>Command-line tool for the Verso interactive notebook platform.</PackageDescription> |
15 | 15 | <GeneratePackageOnBuild>true</GeneratePackageOnBuild> |
|
24 | 24 | <FrameworkReference Include="Microsoft.AspNetCore.App" /> |
25 | 25 | </ItemGroup> |
26 | 26 |
|
27 | | - <!-- Locate blazor.web.js so it can be bundled with the tool. |
28 | | - .NET 10+ ships it as a NuGet static web asset; .NET 8/9 embed it |
29 | | - inside Microsoft.AspNetCore.Components.Endpoints.dll. We try the |
30 | | - NuGet package first (MSBuild glob), then fall back to extracting the |
31 | | - embedded resource via a small inline task. --> |
32 | | - <UsingTask TaskName="_ExtractEmbeddedBlazorJs" |
33 | | - TaskFactory="RoslynCodeTaskFactory" |
34 | | - AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.Core.dll"> |
35 | | - <ParameterGroup> |
36 | | - <SharedFrameworkDir ParameterType="System.String" Required="true" /> |
37 | | - <OutputFile ParameterType="System.String" Required="true" /> |
38 | | - </ParameterGroup> |
39 | | - <Task> |
40 | | - <Code Type="Fragment" Language="cs"><![CDATA[ |
41 | | - var dll = System.IO.Path.Combine(SharedFrameworkDir, "Microsoft.AspNetCore.Components.Endpoints.dll"); |
42 | | - if (!System.IO.File.Exists(dll)) return true; |
43 | | - try |
44 | | - { |
45 | | - var asm = System.Reflection.Assembly.LoadFrom(dll); |
46 | | - using var stream = asm.GetManifestResourceStream("_framework/blazor.web.js"); |
47 | | - if (stream == null) return true; |
48 | | - var dir = System.IO.Path.GetDirectoryName(OutputFile); |
49 | | - if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); |
50 | | - using var fs = System.IO.File.Create(OutputFile); |
51 | | - stream.CopyTo(fs); |
52 | | - } |
53 | | - catch { } |
54 | | - return true; |
55 | | - ]]></Code> |
56 | | - </Task> |
57 | | - </UsingTask> |
58 | | - |
59 | | - <Target Name="_ExtractBlazorFrameworkJs" AfterTargets="Build"> |
60 | | - <!-- Try NuGet package first (.NET 10+) --> |
| 27 | + <!-- blazor.web.js is placed into $(OutputPath)wwwroot/_framework/ before |
| 28 | + build by CI (see .github/workflows) or by the NuGet-cache copy below. |
| 29 | + The pack target then bundles it into the tool package. --> |
| 30 | + <Target Name="_CopyBlazorFrameworkJs" AfterTargets="Build"> |
61 | 31 | <ItemGroup> |
62 | 32 | <_BlazorWebJsFromNuGet Include="$(NuGetPackageRoot)microsoft.aspnetcore.app.internal.assets/*/_framework/blazor.web.js" /> |
63 | 33 | </ItemGroup> |
64 | 34 | <Copy SourceFiles="@(_BlazorWebJsFromNuGet)" |
65 | 35 | DestinationFolder="$(OutputPath)wwwroot/_framework/" |
66 | 36 | SkipUnchangedFiles="true" |
67 | 37 | Condition="'@(_BlazorWebJsFromNuGet)' != ''" /> |
68 | | - <!-- Fallback: extract embedded resource (.NET 8/9 shared framework) --> |
69 | | - <ItemGroup Condition="'@(_BlazorWebJsFromNuGet)' == ''"> |
70 | | - <_AspNetSharedFx Include="$(NetCoreRoot)shared/Microsoft.AspNetCore.App/*" /> |
71 | | - </ItemGroup> |
72 | | - <_ExtractEmbeddedBlazorJs |
73 | | - SharedFrameworkDir="%(_AspNetSharedFx.Identity)" |
74 | | - OutputFile="$(OutputPath)wwwroot/_framework/blazor.web.js" |
75 | | - Condition="'@(_BlazorWebJsFromNuGet)' == '' AND '@(_AspNetSharedFx)' != '' AND !Exists('$(OutputPath)wwwroot/_framework/blazor.web.js')" /> |
76 | | - <Warning Text="Could not locate blazor.web.js; verso serve may not function correctly." |
77 | | - Condition="!Exists('$(OutputPath)wwwroot/_framework/blazor.web.js')" /> |
| 38 | + <Warning Text="blazor.web.js not found in NuGet cache or $(OutputPath)wwwroot/_framework/. Run the extract-blazor-js CI step or copy the file manually." |
| 39 | + Condition="'@(_BlazorWebJsFromNuGet)' == '' AND !Exists('$(OutputPath)wwwroot/_framework/blazor.web.js')" /> |
78 | 40 | </Target> |
79 | 41 |
|
80 | 42 | <!-- Bundle static web assets so the Blazor Server app works when installed |
|
0 commit comments