Desktop app deploy

Can you try running in verbose mode, e.g:

$ app --verbose open mythz/spirals-kiosk

This is the log:

API: https://api.github.com/repos/mythz/spirals-kiosk/releases
Downloading https://github.com/mythz/spirals-kiosk/archive/master.zip => C:\Users\Marco\AppData\Local\Temp\tmpC7E.tmp (nocache)
RMDIR: C:\Users\Marco\AppData\Local\Temp\servicestack\spirals-kiosk
ExtractToDirectory: C:\Users\Marco\AppData\Local\Temp\tmpC7E.tmp -> C:\Users\Marco\AppData\Local\Temp\servicestack\spirals-kiosk
Directory Move: C:\Users\Marco\AppData\Local\Temp\servicestack\spirals-kiosk\spirals-kiosk-master -> C:\Users\Marco\.sharp-apps\spirals-kiosk
Directory Move: C:\Users\Marco\AppData\Local\Temp\servicestack\spirals-kiosk\spirals-kiosk-master -> C:\Users\Marco\.sharp-apps\spirals-kiosk
Directory Move failed: 'Could not find a part of the path.', trying COPY Directory...
Directory Copy: C:\Users\Marco\AppData\Local\Temp\servicestack\spirals-kiosk\spirals-kiosk-master -> C:\Users\Marco\.sharp-apps\spirals-kiosk
COPY C:\Users\Marco\.sharp-apps\spirals-kiosk\.gitignore
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Marco\.sharp-apps\spirals-kiosk\.gitignore'.
   at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at Web.WebTemplateUtils.CopyAllTo(String src, String dst, String[] excludePaths) in C:\src\dotnet-app\src\Web\Startup.cs:line 2887
COPY C:\Users\Marco\.sharp-apps\spirals-kiosk\animated.html
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Marco\.sharp-apps\spirals-kiosk\animated.html'.
   at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at Web.WebTemplateUtils.CopyAllTo(String src, String dst, String[] excludePaths) in C:\src\dotnet-app\src\Web\Startup.cs:line 2887

That rectangle is visible when Windows scale settings is on 100%.
I have 2K monitor - on 125% no rectangle, 100% rectangle visible.

thx this helps, I’m able to repro after changing the screenresolution to 100%, still looking into what’s causing it but at least I can repro it now.

I just tried to install dotnet and app tool inside windows 10 sandbox mode (Windows Sandbox - Microsoft Community Hub)

I’m getting this in all applications:

C:\Users\WDAGUtilityAccount>app --verbose run spirals
Loading GistVirtualFiles from: C:\Users\WDAGUtilityAccount\.sharp-apps\spirals.gist
args: ''
APP_SOURCE=sharp-apps Sharp Apps
Using ''
{
        Tool: app,
        Arguments: [],
        StartUrl: "http://localhost:5000/",
        UseUrls: "http://localhost:5000/",
        AppDir: "C:\Users\WDAGUtilityAccount\.sharp-apps\spirals",
        ToolPath: "C:\Users\WDAGUtilityAccount\.dotnet\tools\.store\app\0.0.56\app\0.0.56\tools\netcoreapp3.1\any\app.dll",
        FavIcon: "C:\Users\WDAGUtilityAccount\.dotnet\tools\.store\app\0.0.56\app\0.0.56\tools\netcoreapp3.1\any\favicon.ico",
        DebugMode: True
}
Application startup exception: System.Exception: RootDir 'C:\Users\WDAGUtilityAccount\.servicestack\cache' for virtual path does not exist
   at ServiceStack.IO.FileSystemVirtualFiles.Initialize() in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Common\IO\FileSystemVirtualFiles.cs:line 34
   at ServiceStack.IO.FileSystemVirtualFiles..ctor(DirectoryInfo rootDirInfo) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Common\IO\FileSystemVirtualFiles.cs:line 27
   at Web.Startup.ConfigureAppHost(ServiceStackHost appHost) in C:\src\dotnet-app\src\Web\Startup.cs:line 2382
   at ServiceStack.ServiceStackHost.<Init>b__32_7(Action`1 fn) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line 268
   at ServiceStack.EnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 action) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Common\EnumerableExtensions.cs:line 131
   at ServiceStack.ServiceStackHost.Init() in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line 270
   at ServiceStack.NetCoreAppHostExtensions.UseServiceStack(IApplicationBuilder app, AppHostBase appHost) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppHostBase.NetCore.cs:line 328
   at Web.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in C:\src\dotnet-app\src\Web\Startup.cs:line 2314
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
      Application startup exception
System.Exception: RootDir 'C:\Users\WDAGUtilityAccount\.servicestack\cache' for virtual path does not exist
   at ServiceStack.IO.FileSystemVirtualFiles.Initialize() in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Common\IO\FileSystemVirtualFiles.cs:line 34
   at ServiceStack.IO.FileSystemVirtualFiles..ctor(DirectoryInfo rootDirInfo) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Common\IO\FileSystemVirtualFiles.cs:line 27
   at Web.Startup.ConfigureAppHost(ServiceStackHost appHost) in C:\src\dotnet-app\src\Web\Startup.cs:line 2382
   at ServiceStack.ServiceStackHost.<Init>b__32_7(Action`1 fn) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line 268
   at ServiceStack.EnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 action) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Common\EnumerableExtensions.cs:line 131
   at ServiceStack.ServiceStackHost.Init() in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line 270
   at ServiceStack.NetCoreAppHostExtensions.UseServiceStack(IApplicationBuilder app, AppHostBase appHost) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppHostBase.NetCore.cs:line 328
   at Web.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in C:\src\dotnet-app\src\Web\Startup.cs:line 2314
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
DevTools listening on ws://127.0.0.1:20480/devtools/browser/7e7ff927-d344-409d-bf4b-70e84c1f5bcc
OnExit

This is failing at the first hurdle from trying to read from the FileSystem. I’m not going to waste any time finding workarounds around every sandbox limitation. You’ll need to look elsewhere if you need it to run in the Win 10 sandox, e.g. PWA’s, UWPs or a sandbox-compatible electron build if it exists.

No, I’m not going to run it inside sandbox. This exact error is also on clean Windows 10 install.
I just give you a way to reproduce error.

1 Like

If I manualy create folder %HOMEPATH%\.servicestack\cache then all applications are working fine (except rectangle in Kiosk mode)

Yep, thx. I’m going through and creating directories where they should exist, will have a build out soon that looks at addressing both issues.

1 Like

I’ve got a new build (0.0.57) that hopefully resolves both issues. With the scrollbar I didn’t find any other solution other than to resize with an additional vertical scrollbar width when the scale factor = 1.0 (i.e. using the default resolution), since the other resolutions seem to include it.

Anyway the vertical scroll bar adjust can be disabled on a per app basis with:

CefConfig { Kiosk:true, Meta: { no: 'scroll-adjust' } }

Yes, everything seems OK.
Sorry that I took you 2 days for this, but we got 1 new feature and some bugs fixed.
Again, thank you.

1 Like

Cool glad to hear it, happy to fix issues to make it more polished & more appealing for different scenarios, I plan on using it as an app delivery for future apps so the more seamless & polished it gets, the better!

Confirming that the app is installing en opening now with the 0.0.57 release! (on a clean win10 installation)…

1 Like

Sweet, glad to hear it!

FYI got another exciting update where the latest version (0.0.60) now supports custom URL schemes to be able to open apps from web page links! Unfortunately I haven’t found any info on whether it’s possible to run an install script when a tool is installed, so you’ll need to run the app at least once where it will create the URL Scheme registry key entries if it doesn’t exist, e.g:

$ app -version

Now you should be able to launch Sharp Apps from links, e.g. we can open the spirals Gist Desktop App with either:

app://spirals
app:spirals

Unfortunately Discourse strips the URL from the last one so need to copy/paste into browser’s URL

It just translates the URL to the app open command so it supports anything app open does, e.g. we can load our kiosk app above with:

app://mythz/spirals-kiosk

You can use the queryString to pass parameters, so you can open an app in a private repo with:

app://dejanadamovic/boxfront?token={GITHUB_TOKEN}

If you have any params with escape chars you’ll just need to URL encode them:

app://mythz/spirals-kiosk?url=https://localhost:5001&msg=Hello%20World!

The variables are registered as context arguments so they’re available in your page under the same name:

{{url}} //= https://localhost:5001
{{msg}} //= Hello World!

Whilst the {{ARGV}} variable contains a list of all the command line arguments where ?url is converted to -url.

Hope this is able to improve the UX & accessibility of your Apps!

Note: I’m surprised the optimal app: URL scheme wasn’t already reserved by default but in-case it gets hijacked by other software in future you can also use the fallback sharp: URL scheme, e.g:

sharp://spirals

Also not sure if it’s useful but you can also run “headless” Sharp Apps with the xapp URL scheme (x: was invalid), which will instead invoke the x x-plat command-line dotnet tool to run the Sharp App, e.g:

xapp://spirals

My plugin requires System.IO.Ports.dll (installed as nuget package in project).
Is it possible to add it in plugins folder and load assembly somehow?
App is deployed with github.

All .dll’s in the /plugins folder are loaded with Assembly.Load() which may just work as-is, otherwise you may need a custom deployment like copying any additional .dll’s to the app dotnet tool’s bin folder, e.g. the latest app v71 installs their .dll’s at:

%USERPROFILE%\.dotnet\tools\.store\app\0.0.71\app\0.0.71\tools\netcoreapp3.1\any

Copying dll in plugins folder didn’t work by itself, nor is copying to app/bin folder.
However, copying dll in /plugins folder with this code worked:

var path = Path.Combine(appHost.GetHostingEnvironment().ContentRootPath, "plugins", "System.IO.Ports.dll");
//Assembly.Load(path) does not work
AssemblyLoadContext.Default.LoadFromAssemblyPath(path);

I don’t know is this best solution, but it works for now.

1 Like

FYI I’ve changed the latest v0.0.72 app and x dotnet tools to use AssemblyLoadContext.Default.LoadFromStream() to load .dll’s in /plugins so it may just work with the latest version.

Also the app Desktop tool now includes all dotnet/pinvoke NuGet packages so you can use them in your App to access Win32 APIs without needing to deploy them with your App.

Another new feature is that app: now behaves like run where it will run your locally installed App if it exists i.e. instead of downloading the latest version that open app:// URL Scheme does, so:

app:spirals

Equivalent to:

$ app run spirals

app://spirals

Equivalent to:

$ app open spirals
1 Like

With latest update I cannot start any of desktop apps. App window appears but there is no content.
Also tested on clean Windows 10 installation with only dotnet core and app installed.

app open spirals

does not work. However when I start app with

x open spirals

and open https://localhost:5001 in browser first it shows certificate warning and after confirming with “Proceed” it shows page content (maybe this can be helpful).

Clean installation of Windows 10, version 2004, build 19041.329
Clean installation od dotnet core SDK 3.1.301, Runtime 3.1.5

app --version
Version: 0.0.72
ServiceStack: 5.8
Framework: .NET Core 3.1.5
OS: Microsoft Windows NT 6.2.9200.0
Chromium: 81.0.4044.113