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

WPF app with BlazorWebView fails to compile the Razor components #3526

Closed
danroth27 opened this issue Nov 23, 2021 · 5 comments · Fixed by #4884
Closed

WPF app with BlazorWebView fails to compile the Razor components #3526

danroth27 opened this issue Nov 23, 2021 · 5 comments · Fixed by #4884
Assignees
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView feature-blazor-windesktop Issues in Blazor in WPF or WinForms fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! platform/windows 🪟 t/bug Something isn't working

Comments

@danroth27
Copy link
Member

Description

I created a WPF app with a BlazorWebView and then tried to add the code for the default Blazor template, but I get a compilation error saying that one of the namespaces is missing, even though I have components in the Shared folder:

error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf'

Here's my code: https://github.com/danroth27/BlazorHybridWpf

Steps to Reproduce

  1. Clone and build https://github.com/danroth27/BlazorHybridWpf

Version with bug

Preview 10 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Win11

Did you find any workaround?

No response

Relevant log output

No response

@danroth27 danroth27 added the t/bug Something isn't working label Nov 23, 2021
@danroth27
Copy link
Member Author

@Eilon

@danroth27
Copy link
Member Author

1>------ Rebuild All started: Project: BlazorHybridWpf, Configuration: Debug Any CPU ------
Restored C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\BlazorHybridWpf.csproj (in 22 ms).
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\Pages\Index.razor(9,1,9,56): warning RZ10012: Found markup element with unexpected name 'SurveyPrompt'. If this is intended to be a component, add a @using directive for its namespace.
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>C:\Users\user\source\repos\BlazorHybridWpf\BlazorHybridWpf\_Imports.razor(9,23,9,29): error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'BlazorHybridWpf' (are you missing an assembly reference?)
1>Done building project "BlazorHybridWpf_n5hqffra_wpftmp.csproj" -- FAILED.

@Eilon Eilon added area-blazor Blazor Hybrid / Desktop, BlazorWebView feature-blazor-windesktop Issues in Blazor in WPF or WinForms labels Nov 23, 2021
@Eilon
Copy link
Member

Eilon commented Nov 30, 2021

This reproduces locally for me. There's something weird about everything in Shared in here. It's like it's somehow not in the compilation at all. Razor works just fine, as long as you don't have anything in Shared. Yet the C# compilation has the relevant AdditionalFiles with all the right paths...

@mkArtakMSFT
Copy link
Member

Let's spent one day to understand what is the issue here first. Depending on the findings and how much time will be required to address that issue we'll then decide whether this will be supported for the initial release or not.

@mkArtakMSFT
Copy link
Member

For time being, customers can add their components in Razor Class Libraries instead.

@v-xiaofchen v-xiaofchen added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Feb 28, 2022
@mkArtakMSFT mkArtakMSFT added this to the 6.0.300-preview.14 milestone Mar 24, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 23, 2022
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Feb 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView feature-blazor-windesktop Issues in Blazor in WPF or WinForms fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! platform/windows 🪟 t/bug Something isn't working
Projects
None yet
6 participants