Skip to content
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

Support using Blazor to build .NET tools #47576

Open
danroth27 opened this issue Apr 5, 2023 · 3 comments
Open

Support using Blazor to build .NET tools #47576

danroth27 opened this issue Apr 5, 2023 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one
Milestone

Comments

@danroth27
Copy link
Member

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: dotnet/sdk#28881. This issue tracks improving the user experience and making this a supported scenario with proper guidance.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Apr 5, 2023
@gfs
Copy link

gfs commented Apr 5, 2023

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?

Background

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).

@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Apr 5, 2023
@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone Apr 5, 2023
@ghost
Copy link

ghost commented Apr 5, 2023

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.

@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, BlazorPlanning Nov 5, 2023
@ghost
Copy link

ghost commented Nov 29, 2023

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.

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

No branches or pull requests

6 participants
@gfs @danroth27 @MackinnonBuck @wtgodbe @mkArtakMSFT and others