edandersen / blazor-desktop-crossplatform-sample

Example of an actual cross platform web and desktop hybrid Blazor app using the .NET 6 Blazor Desktop implementation
167 stars 46 forks source link

System.IO.DirectoryNotFoundException when running the exe on another PC #10

Open cma019 opened 2 years ago

cma019 commented 2 years ago

Hi @edandersen, Thank you for the sample! I'm having trouble when I tried to run the winForm.exe on another PC. I have already copied the whole debug / release folder. It throws System.IO.DirectoryNotFoundException on execute and the directory is still pointing to the project folder.

edandersen commented 2 years ago

Which version? Winforms or WPF?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: cma019 @.> Sent: Tuesday, March 29, 2022 4:34:24 PM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Subscribed @.***> Subject: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

Thank you for the sample. I'm having trouble when I tried to run the winForm.exe on another PC. I have already copied the whole debug / release folder. It throws System.IO.DirectoryNotFoundException on execute and the directory is still pointing to the project folder.

— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HGDD6DQWETIZ4GFPDLVCMPIBANCNFSM5R62KEHA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

cma019 commented 2 years ago

WinForm. When running BlazorWinFormsApp.exe on another PC, System.IO.DirectoryNotFoundException: D:\blazor-desktop-crossplatform-sample-master\src\BlazorWinFormsApp\wwwroot\

Update: i tried publish, it now throws System.IO.FileNotFoundException: The system cannot find the file specified.

edandersen commented 2 years ago

Interesting, I will take a lool

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: cma019 @.> Sent: Tuesday, March 29, 2022 4:54:38 PM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Ed Andersen @.>; Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

WinForm. When running BlazorWinFormsApp.exe on another PC, System.IO.DirectoryNotFoundException: D:\blazor-desktop-crossplatform-sample-master\src\BlazorWinFormsApp\wwwroot\

— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10#issuecomment-1082054416, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HHG6TRKO44VILVX3YTVCMRT5ANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

edandersen commented 2 years ago

Look.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Ed Andersen @.> Sent: Tuesday, March 29, 2022 5:18:04 PM To: edandersen/blazor-desktop-crossplatform-sample @.>; edandersen/blazor-desktop-crossplatform-sample @.> Cc: Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

Interesting, I will take a lool

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: cma019 @.> Sent: Tuesday, March 29, 2022 4:54:38 PM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Ed Andersen @.>; Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

WinForm. When running BlazorWinFormsApp.exe on another PC, System.IO.DirectoryNotFoundException: D:\blazor-desktop-crossplatform-sample-master\src\BlazorWinFormsApp\wwwroot\

— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10#issuecomment-1082054416, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HHG6TRKO44VILVX3YTVCMRT5ANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

ysinsane commented 2 years ago

Say I have 2 pcs, PC A is my laptop I use it to code. PC B is a remote PC I use it to debug. I encountered the similar problem. I tried to use remote debug to run the "output" from a remote PC B. But it seems that the program is still expected "wwwroot" on PC A. image

edandersen commented 2 years ago

Interesting.

Likely my last change to remove the copying and pasting of wwwroot assets didn’t work properly. Try from the previous commit – you’ll need to add the wwwroot assets to each project and mark as include.

From: @.> Sent: 01 April 2022 08:51 To: @.> Cc: Ed @.>; @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

Say I have 2 pcs, PC A is my laptop I use it to code. PC B is a remote PC I use it to debug. I encountered the similar problem. I tried to use remote debug to run the "output" from a remote PC B. But it seems that the program is still expected "wwwroot" on PC A. [image]https://user-images.githubusercontent.com/22684009/161219672-2fd28c10-1bda-4d8c-bfed-fc4ddc8104f4.png

— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10#issuecomment-1085547870, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HF7RVQQBOQFIZKTM7TVC2TJRANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

jungyoseok commented 1 year ago

[Built using .net7 sdk using visual studio 2022] @edandersen First of all, great and impressive example!

I am experiencing the same problem.

I built a release version of BlazorWinFormsApp on my PC. Runs & Works great.

I wanted to try running this BlazorWinFormsApp on another PC. so I copied & moved the release folder to another PC and run BlazorWinformsApp.exe. It says System.IO.DirectoryNotFoundException on execute. What can I try to make this work?

edandersen commented 1 year ago

You should take a look at MAUI, it's actually supported by MS and has a Blazor view control.


From: jungyoseok @.> Sent: Tuesday, January 3, 2023 5:11:09 PM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Ed Andersen @.>; Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

[Built using .net7 sdk using visual studio 2022] @edandersenhttps://github.com/edandersen First of all, great and impressive example!

I am experiencing the same problem.

I built a release version of BlazorWinFormsApp on my PC. Runs & Works great.

I wanted to try running this BlazorWinFormsApp on another PC. so I copied & moved the release folder to another PC and run BlazorWinformsApp.exe. It says System.IO.DirectoryNotFoundException on execute. What can I try to make this work?

— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10#issuecomment-1369485219, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HBVBE6G7BQKAC2CU7TWQPNJ3ANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

ysinsane commented 1 year ago

You should take a look at MAUI, it's actually supported by MS and has a Blazor view control. ____ From: jungyoseok @.> Sent: Tuesday, January 3, 2023 5:11:09 PM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Ed Andersen @.>; Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10) [Built using .net7 sdk using visual studio 2022] @edandersenhttps://github.com/edandersen First of all, great and impressive example! I am experiencing the same problem. I built a release version of BlazorWinFormsApp on my PC. Runs & Works great. I wanted to try running this BlazorWinFormsApp on another PC. so I copied & moved the release folder to another PC and run BlazorWinformsApp.exe. It says System.IO.DirectoryNotFoundException on execute. What can I try to make this work? — Reply to this email directly, view it on GitHub<#10 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HBVBE6G7BQKAC2CU7TWQPNJ3ANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

True, but it seems that MS didn't provide any configuration we can touch to change this default behavior. That's a reason I stopped playing with blazor. MS always act like this. No wonder people don't like it.

edandersen commented 1 year ago

Don't blame you tbh.


From: ysinsane @.> Sent: Wednesday, January 4, 2023 11:03:21 AM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Ed Andersen @.>; Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10)

You should take a look at MAUI, it's actually supported by MS and has a Blazor view control. … ____ From: jungyoseok @.> Sent: Tuesday, January 3, 2023 5:11:09 PM To: edandersen/blazor-desktop-crossplatform-sample @.> Cc: Ed Andersen @.>; Mention @.> Subject: Re: [edandersen/blazor-desktop-crossplatform-sample] System.IO.DirectoryNotFoundException when running the exe on another PC (Issue #10https://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10) [Built using .net7 sdk using visual studio 2022] @edandersenhttps://github.com/edandersenhttps://github.com/edandersen First of all, great and impressive example! I am experiencing the same problem. I built a release version of BlazorWinFormsApp on my PC. Runs & Works great. I wanted to try running this BlazorWinFormsApp on another PC. so I copied & moved the release folder to another PC and run BlazorWinformsApp.exe. It says System.IO.DirectoryNotFoundException on execute. What can I try to make this work? — Reply to this email directly, view it on GitHub<#10 (comment)https://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10#issuecomment-1369485219>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HBVBE6G7BQKAC2CU7TWQPNJ3ANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

True, but it sames that MS didn't provide any configuration we can touch to change this default behavior. That's a reason I stopped playing with blazor. MS always act like this. No wonder people don't like it.

— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/blazor-desktop-crossplatform-sample/issues/10#issuecomment-1370406129, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HHM44UYGALK6P6CIFLWQTK6TANCNFSM5R62KEHA. You are receiving this because you were mentioned.Message ID: @.***>

jungyoseok commented 1 year ago

Got it to work.

edandersen commented 1 year ago

Oh? What was the secret?

jungyoseok commented 1 year ago

I used a powershell to publish

cd into BlazorWinFormsApp dotnet publish -f net6.0-windows --sc -r win-x64

then moved the publish folder to another PC and turns out it works! I had to install webview2 runtime on this other PC that I am trying to run the application in (I didn't realize I was using older version of Windows 10 which was missing webview2 runtime)

@edandersen Thank you for this awesome template that I can start my project with!

edandersen commented 1 year ago

Nice one! I'll probably add that to the readme