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

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

Open
cma019 opened this issue Mar 29, 2022 · 14 comments
Open

Comments

@cma019
Copy link

cma019 commented Mar 29, 2022

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
Copy link
Owner

edandersen commented Mar 29, 2022 via email

@cma019
Copy link
Author

cma019 commented Mar 29, 2022

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
Copy link
Owner

edandersen commented Mar 29, 2022 via email

@edandersen
Copy link
Owner

edandersen commented Mar 29, 2022 via email

@ysinsane
Copy link

ysinsane commented Apr 1, 2022

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
Copy link
Owner

edandersen commented Apr 1, 2022 via email

@jungyoseok
Copy link

[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
Copy link
Owner

edandersen commented Jan 3, 2023 via email

@ysinsane
Copy link

ysinsane commented Jan 4, 2023

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
Copy link
Owner

edandersen commented Jan 4, 2023 via email

@jungyoseok
Copy link

Got it to work.

@edandersen
Copy link
Owner

Oh? What was the secret?

@jungyoseok
Copy link

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants