Skip to content

The type 'GlobalStaticResources' exists in both ... #8750

@jeromelaban

Description

@jeromelaban

Current behavior

When building an application, the following message may arise:

error CS0433: The type 'GlobalStaticResources' exists in both 'XXX, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null' and 'XXX, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null'

Expected behavior

The compilation succeeds.

How to reproduce it (as minimally and precisely as possible)

Craete an application which contains two projects that use the same default C# namespace.

Workaround

Change the default namespace to be different for each assemblies.

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

4.2.6

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

This issue is caused by the fact that the code generator uses the default namespace to create the GlobalStaticResources class, and uses it in App.xaml generation to initialize resources. These types conflict because they can be found in two assemblies, with the same qualified name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/code-generationCategorizes an issue or PR as relevant to code generationdifficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't workingno-repro

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions