AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.53k stars 2.21k forks source link

avalonia.js 404 #16441

Closed githubxiaoa closed 2 months ago

githubxiaoa commented 2 months ago

Describe the bug

avalonia.js 404 微信截图_20240724170111

To Reproduce

not run

Expected behavior

No response

Avalonia version

11.1.0

OS

Windows, WebAssembly

Additional context

No response

maxkatz6 commented 2 months ago

Try to recreate browser project from the avalonia.xplat template.

githubxiaoa commented 2 months ago

I have created a new project without making any changes, but it is still unsuccessful

msneijders commented 2 months ago

Using template v1.14 it works running from visual studio (it finds and reads an avalonia.js file) -- but when I deploy (testing with a local IIS), I cannot find the avalonia.js file in _framework folder. I copied the content from avalonia.js that is generated while debugging from visual studio from within the browsers DevTools (because I cannot find it in wwwroot/_framework), and put it in the _framework folder of the deployment; then it runs.

maxkatz6 commented 2 months ago

I have created a new project without making any changes, but it is still unsuccessful

It doesn't give much information on how you run it. New project templates work just fine here, via dotnet run and dotnet publish (which are the most important). If any IDE doesn't handle running projects - report the issue to them.

testing with a local IIS

Can't really help with IIS. Don't see reasons to use it also. For local testing of published packages, I recommend dotnet serve tool. For production there are various static website cloud providers as well, or nginx should work too just fine.

but when I deploy

Do you deploy with dotnet publish btw? Any other way won't work.