Skip to content

Compilation fails when resource file is name Resources.resx #167

@plfaucher

Description

@plfaucher

Describe the Bug

Compilation fails when resource file is name Resources.resx

Steps to Reproduce

Using ThisAssembly 1.1.3

We have a Resources.resx file, set as Embedded resource, and when updating from 1.0.10 to 1.1.3 we get this error at compile:

'Resources': member names cannot be the same as their enclosing type

This is the file generated by ThisAssembly

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     ThisAssembly.Resources: 1.1.3
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.IO;

partial class ThisAssembly
{
    public static partial class Resources
    {
        /// <summary>
        /// => @"Resources.resx"
        /// </summary>
        public static partial class Resources
        {
            public static byte[] GetBytes() => EmbeddedResource.GetBytes(@"Resources.resx");
            public static Stream GetStream() => EmbeddedResource.GetStream(@"Resources.resx");
        }
    }
}

Expected Behavior

I'd expect the version bump to work as it is a minor version.

Exception with Stack Trace

1>------ Rebuild All started: Project: REDACTED, Configuration: Debug Any CPU ------
1>C:\Users\redacted\Code\redacted\src\redacted\ThisAssembly.Resource\ThisAssembly.ResourcesGenerator\Resources.g.cs(21,37,21,46): error CS0542: 'Resources': member names cannot be the same as their enclosing type
1>Done building project "REDACTED.csproj" -- FAILED.

Version Info

We are currently on 1.0.10 and trying to upgrade to 1.1.3

Additional Info

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions