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

Add Relative Path for the AppShell #2

Open
jdevillard opened this issue Apr 4, 2024 · 3 comments
Open

Add Relative Path for the AppShell #2

jdevillard opened this issue Apr 4, 2024 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@jdevillard
Copy link
Contributor

New Feature Proposal

Add capability to Emulator to load app shell from a relative path to the Pilet.
For now, we can use an app shell using an absolute path.

Description

We can add an attribute to <AppShell /> like ../../path/to/shell

Background

This will allow faster dev/test on local environment.

@jdevillard jdevillard added the enhancement New feature or request label Apr 4, 2024
@FlorianRappl
Copy link
Contributor

For now, we can use an app shell using an absolute path.

That is not true. You can use NuGet package paths. This is also the recommended way.

@jdevillard
Copy link
Contributor Author

Agree, but the emulator is looking at

    var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
    var name = assembly.GetCustomAttribute<Piral.Blazor.Sdk.AppShellAttribute>()!.Name.ToLowerInvariant();
    var path = Path.Combine(userProfile, ".nuget", "packages", name);

So when working on a Solution with Shell and Pilet, we have to pack the nuget and copy it to the %userprofile%/.nuget/packages folder, no ?

If we specify an absolute folder to the /bin of the shell, the emulator seems to work, but maybe this as some side effects.

Why don't allow relative path to the /bin ? or to another folder where nuget package can be found?

@FlorianRappl
Copy link
Contributor

FlorianRappl commented Apr 4, 2024

So when working on a Solution with Shell and Pilet, we have to pack the nuget and copy it to the %userprofile%/.nuget/packages folder, no ?

I don't know. Well, at some point you need to pack and distribute; when that is would be up to you. The ideal situation is that a local shell is detected and just used.

If we specify an absolute folder to the /bin of the shell, the emulator seems to work, but maybe this as some side effects.

This is intentional. So this works; absolute paths always work. The problem with relative paths is defining what the path is relative to. You would think it should be the csproj, but we don't know the csproj and we are actually running from some subdirectory of bin, so its quite unclear. A better solution, as mentioned, is to allow referencing local projects; so if you reference MyShell and MyShell is specified in the <AppShell> field you'd actually get this. The benefit of this approach is that we could actually resolve the shell properly and maybe even build it - if it wasn't build.

@FlorianRappl FlorianRappl added this to the v0.5 milestone Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants