Open danroth27 opened 1 year ago
Thanks @danroth27 for picking this issue back up! I think this is a really neat way to use Blazor.
If an example of this is interesting for your development, I am currently using the workaround I mentioned in dotnet/sdk#28881 in AttackSurfaceAnalyzer: https://github.com/microsoft/AttackSurfaceAnalyzer/blob/8f3ee6911ae19650e0dc433aecddef60d7cca151/Cli/AttackSurfaceAnalyzerClient.cs#L435-L471.
We use this to provide a simple cross platform GUI in our published nuget:
dotnet tool install -g Microsoft.CST.AttackSurfaceAnalyzer.CLI
You can launch the GUI with:
asa gui
As for how this could be better supported. Maybe it is possible as part of the build to inject the expected relative staticwebassets path with respect to the unpacked tool binary to some value that can be accessed with reflection?
Prior to .NET 6 the wwwroot
was included in nupkg alongside the binaries, so when running an unpacked .net tool this would transparently work using the assets from wwwroot
adjacent to the binaries. For an example, see attack surface analyzer 2.2.78 nupkg which was built with .NET 5. In .NET 5 it appears wwwroot
was also packed to the staticwebassets
folder at the root of the nupkg.
Starting in .NET 6, wwwroot
is no longer packed alongside the binaries in the nupkg and appears to only be included once in the staticwebassets
folder (for an example with both .NET 6 and .NET 7 binaries see asa 2.3.297).
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
You can create .NET tools that can be installed and used from the .NET CLI. It would be useful if you could build a UI for a .NET tool using Blazor. It looks like this used to be possible at some point but then a change to static web assets made the scenario more difficult: https://github.com/dotnet/sdk/issues/28881. This issue tracks improving the user experience and making this a supported scenario with proper guidance.