Skip to content

Folder in solution with name "Uno" causes namespace resolution errors #28

Closed

Description

@FrancoisM

I'm trying to add Uno to an existing solution.
I "logically" created a Uno folder in the solution. I added MyApp.Uno.UPW, MyApp.Uno.iOS and MyApp.Uno.Shared projects with the proper nuget packages and references.
When I build the iOS project I had an error like:

The type or namespace name 'UI' does not exist in the namespace 'MyApp.Uno' (are you missing an assembly reference?)

I had to rename my folder to UnoApp and projects to MyApp.UnoApp.UWP etc to get it to compile.

Activity

  1. added
    kind/bug
    on Jun 16, 2018
  2. jeromelaban commented on Jun 16, 2018

    @jeromelaban
    Member

    Looks like the Uno source generators are missing some global:: prefixes :)

    The best practice for now is to avoid Uno, System and Android in the project's name.

  3. ghuntley commented on Oct 9, 2019

    @ghuntley
    Member

    👋 had the opportunity to dig into this and this is what I found.

    1. File -> New "MyApp.Uno"
    2. Update to latest pre-release of Uno.* packages
    3. Building on WASM and Android results in
    Error        CS0234        The type or namespace name 'Extensions' does not exist in the namespace 'MyApp.Uno' (are you missing an assembly reference?)        MyApp.Uno.Droid, MyApp.Uno.UWP, MyApp.Uno.Wasm, MyApp.Uno.iOS        C:\code\unoplatform\MyApp.Uno\MyApp.Uno\MyApp.Uno.Shared\App.xaml.cs        32        Active
    
    1. Adding global:: namespace to ConfigureFilters resolves
            public App()
            {
                ConfigureFilters(global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory);
    
                this.InitializeComponent();
                this.Suspending += OnSuspending;
            }
    
    1. Android and WebAsm compile fine.
    2. iOS untested, pending macOS configuration on Geoff's end due to Catalina release.

    PR raised over at #1771

  4. peternary commented on Oct 10, 2019

    @peternary

    I'm still getting this issue with latest Uno build. Sample project attached.
    Test2.Uno.zip

  5. ghuntley commented on Oct 10, 2019

    @ghuntley
    Member

    Sorry to hear that Peter, thank-you for attaching a test case - investigating.

  6. ghuntley commented on Oct 10, 2019

    @ghuntley
    Member

    Howdy,

    I was able to reproduce the issue in the above test case. The solution is to add global:: to ConfigureFilters to your existing applications. See geoffreyhuntley/uno-28@f15c8aa for a diff.

    The PR at #1771 fixes the problem in the solution template generator and next time we publish a stable release that fix will be included. We currently don't automatically publish pre-release versions of the Visual Studio extension to the market place but do publish them as artifacts over at https://github.com/unoplatform/uno/pull/1213/files

    I'll raise a item on the backlog for devops to investigate/implement if the Visual Studio market place supports the notion of publishing pre-releases.

    Build Log before adding global::

    Android:

    Severity        Code        Description        Project        File        Line        Suppression State
    Error        CS0234        The type or namespace name 'Extensions' does not exist in the namespace 'Test2.Uno' (are you missing an assembly reference?)        Test2.Uno.Droid        C:\Users\ghuntley\Downloads\Test2.Uno\Test2.Uno\Test2.Uno.Shared\App.xaml.cs        32        Active
    

    iOS:

    Severity        Code        Description        Project        File        Line        Suppression State
    Error        CS0234        The type or namespace name 'Extensions' does not exist in the namespace 'Test2.Uno' (are you missing an assembly reference?)        Test2.Uno.iOS        C:\Users\ghuntley\Downloads\Test2.Uno\Test2.Uno\Test2.Uno.Shared\App.xaml.cs        32        Active
    

    UWP:

    Severity        Code        Description        Project        File        Line        Suppression State
    Error        CS0234        The type or namespace name 'Extensions' does not exist in the namespace 'Test2.Uno' (are you missing an assembly reference?)        Test2.Uno.UWP        C:\Users\ghuntley\Downloads\Test2.Uno\Test2.Uno\Test2.Uno.Shared\App.xaml.cs        32        Active
    

    WASM:

    Severity        Code        Description        Project        File        Line        Suppression State
    Error        CS0234        The type or namespace name 'Extensions' does not exist in the namespace 'Test2.Uno' (are you missing an assembly reference?)        Test2.Uno.Wasm        C:\Users\ghuntley\Downloads\Test2.Uno\Test2.Uno\Test2.Uno.Shared\App.xaml.cs        32        Active
    
    GitHub
  7. ghuntley commented on Oct 10, 2019

    @ghuntley
    Member

    Let me know if this doesn't resolve your issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions