-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[wasm] wasmconsole template: Add <WasmExtraFilesToDeploy> to Up-to-date Check #77285
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsConsider I have the following in my wasm browser project: <ItemGroup>
<WasmExtraFilesToDeploy Include="main.js" />
</ItemGroup> I make some changes to some C# code, and perform a build. I then get the following output in Visual Studio:
I then realise that some of my JavaScript isn't quite right in
The new version of main.js has not been copied over to the AppBundle directory. The only way around this is to do a full rebuild, or a clean and a rebuild. Its is an awkward change a workflow that usually involves just making a change, and then pressing Ctrl + Shift + B to perform a rebuild. This is due to the FastUpToDate check performed by Visual Studio - the system is documented here: https://github.com/dotnet/project-system/blob/main/docs/up-to-date-check.md Initially I tried the following, documented solution (just focusing on main.js for the moment): <!-- MyWasmProject.csproj -->
<ItemGroup>
<UpToDateCheckBuilt Include="$(WasmAppDir)/main.js" Original="$(MSBuildThisFileDirectory)main.js" />
</ItemGroup> Unfortunately, this does not work, as runtime/src/mono/wasm/build/WasmApp.targets Lines 247 to 260 in b1aa168
Is there a specific reason that the variable is defined this way? Is there a different way that the UpToDateCheckBuilt can be registered so the target registers the changes to main.js (and other WasmExtraFilesToDeploy)? I'd be happy to contribute a PR - at the very least I'd like to move the declaration of $(WasmAppDir) outside the of target if possible, so that I can define my own conditions that use it. Workarounds
|
I think one of the reasons for having it in a target was that
|
Its not clear to me either what this would compare to. I've done some testing using different Reference output for a correct up to date check
I did the following steps for each
I get the following output:
<UpToDateCheckBuilt Include="@(WasmExtraFilesToDeploy)"/> First build after a change to main.js
Output from next build (should be up to date at this point)
<UpToDateCheckOutput Include="@(WasmExtraFilesToDeploy)" /> First build after a change to main.js
Output from next build (should be up to date at this point)
<UpToDateCheckInput Include="@(WasmExtraFilesToDeploy)" /> First build after a change to main.js
Output from next build (should be up to date at this point)
<UpToDateCheckBuilt Include="@(WasmExtraFilesToDeploy -> '%(RelativeDir)')" /> First build after a change to main.js (looks like it hasn't detected a change at all)
Output from next build (should be up to date at this point) - same output as above
Any of these options appear to break the up to date check - no subsequent build sees that the files are up to date. |
IIUC, the output assembly, pdbs, app.config etc are the output files compared against. We can add a target to run before |
I've been testing this a bit more (still a hardcoded wasm app dir): <ItemGroup>
<WasmExtraFilesToDeploy Include="index.html" />
<WasmExtraFilesToDeploy Include="main.js" />
</ItemGroup>
<Target Name="CollectWasmExtraFilesToDeploy" BeforeTargets="CollectUpToDateCheckBuiltDesignTime">
<ItemGroup>
<UpToDateCheckBuilt Include="@(WasmExtraFilesToDeploy -> '$(OutputPath)/AppBundle/%(Filename)%(Extension)')" Original="@(WasmExtraFilesToDeploy -> '$(MSBuildThisFileDirectory)%(Filename)%(Extension)')" />
</ItemGroup>
<Message Text="WasmAppDir is $(WasmAppDir)" />
<Error Text="WasmAppDir is $(WasmAppDir)" />
</Target> I can't get the
So it still looks like no luck - unless I'm not quite following what you meant above. From what I understand sets seems like a performance optimization, so I figured we should ignore them for now until we get something basic working. Once the error target is commented out (so the fast up to date check can continue), we get the following output
If I only have 1 <ItemGroup>
<WasmExtraFilesToDeploy Include="main.js" />
</ItemGroup>
<Target Name="CollectWasmExtraFilesToDeploy" BeforeTargets="CollectUpToDateCheckBuiltDesignTime">
<ItemGroup>
<UpToDateCheckBuilt Include="@(WasmExtraFilesToDeploy -> '$(OutputPath)/AppBundle/%(Filename)%(Extension)')" Original="@(WasmExtraFilesToDeploy -> '$(MSBuildThisFileDirectory)%(Filename)%(Extension)')" />
</ItemGroup>
</Target> We actually get a successful up to date check (again, still with a hardcoded AppBundle dir), so I'm not sure if my transform is incorrect in order to work with multiple inputs. |
Specifying a We should also consider what else should be added to these up-to-date checks for wasm template apps. |
The |
Just wanted to chime in with an update on this issue - it doesn't appear to be fixed using Given the following <WasmExtraFilesToDeploy Include="dist/main.js" /> After making a direct change to the file at "dist/main.js", the FUTDC does NOT detect the change, so performing a build just results in
As WASM now uses tooling centralised in the SDK, it would be good to figure out if this is a bug the within the StaticWebAssets tooling from the SDK, or if its a bug with how Could this be because I am using the SDK specified in Edit: The csproj file for the <WasmExtraFilesToDeploy Include="./wwwroot/main.js" /> in the csproj. So, it seems like this is still an issue. |
Yes. The The |
I've just realised that the issue title has I've updated the title to reflect that. |
The plan is to resolve this issue by migrating the template to WebAssembly SDK, tracked in #70762 |
Updating: template migration is tracked by #102743 |
Consider I have the following in my wasm browser project:
I make some changes to some C# code, and perform a build. I then get the following output in Visual Studio:
I then realise that some of my JavaScript isn't quite right in
main.js
so and go and update it - I then do another build, only to seeThe new version of main.js has not been copied over to the AppBundle directory. The only way around this is to do a full rebuild, or a clean and a rebuild. Its is an awkward change a workflow that usually involves just making a change, and then pressing Ctrl + Shift + B to perform a rebuild.
This is due to the FastUpToDate check performed by Visual Studio - the system is documented here: https://github.com/dotnet/project-system/blob/main/docs/up-to-date-check.md
Initially I tried the following, documented solution (just focusing on main.js for the moment):
Unfortunately, this does not work, as
$(WasmAppDir)
is not defined until a build has actually been started:runtime/src/mono/wasm/build/WasmApp.targets
Lines 247 to 260 in b1aa168
Is there a specific reason that the variable is defined this way? Is there a different way that the UpToDateCheckBuilt can be registered so the target registers the changes to main.js (and other WasmExtraFilesToDeploy)?
I'd be happy to contribute a PR - at the very least I'd like to move the declaration of $(WasmAppDir) outside the of target if possible, so that I can define my own conditions that use it.
Workarounds
The text was updated successfully, but these errors were encountered: