Skip to content

Dummy class namespace in Blazor localization shared resource section #34312

@mobinseven

Description

@mobinseven

Description

I think the dummy class namespace should be set something other than what is written in the documentation. Because the compiler detects an already existing class with the same name.

The dummy class:

namespace BlazorSample.Localization;

public class SharedResource
{
}

And the class generated from .resx:

namespace BlazorSample.Localization {
    using System;
...
    public class SharedResource {
        
        private static global::System.Resources.ResourceManager resourceMan;
...

Which throws:

Localization\SharedResource.Designer.cs(25,18,25,32): error CS0101: The namespace 'BlazorSample.Localization' already contains a definition for 'SharedResource'

If you change the namespace of the dummy class to the root namespace all will be well.

BlazorSample.zip

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-8.0#shared-resources

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/globalization-localization.md

Document ID

d6f07538-228e-9f96-680f-6c324caf11d6

Article author

@guardrex

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions