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

NET Core 3.0.0 - incorrect embedded resource name if resource and code files differ only by extension #3470

Closed
Husqvik opened this issue Sep 25, 2019 · 5 comments

Comments

@Husqvik
Copy link

Husqvik commented Sep 25, 2019

NET Core 3.0.0 - incorrect embedded resource name if resource and code file names differ only by extension in the same folder

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <EmbeddedResource Include="MyCsFile.xml" />
  </ItemGroup>

</Project>

// in file MyCsFile.cs
namespace NetConsoleApp1
{
    public class FirstClassInTheCsFile
    {
    }
}

// Program.cs
using System;

namespace NetConsoleApp1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Console.WriteLine(typeof(FirstClassInTheCsFile).Assembly.GetManifestResourceNames()[0]);
        }
    }
}

Output:

NetConsoleApp1.FirstClassInTheCsFile

Expected:

NetConsoleApp1.MyCsFile.xml

Observed: after cs file or xml file name has been changed just starting the app in debug mode does not build the change into the binaries. Rebuild does.

@jamshedd
Copy link
Member

@JasonCard, could you please help redirect?

@JasonCard
Copy link

Hi @jamshedd, I work on .NET content localization, so I think you may have pinged the wrong person?

@dasMulli
Copy link

cc @rainersigwald @nguerrera

This is a known issue with resources in the 3.0 SDK

@dasMulli
Copy link

See dotnet/msbuild#4740

The known issue document describes this at https://github.com/dotnet/core/blob/master/release-notes/3.0/3.0-known-issues.md#preview-9.

You basically need to set

<PropertyGroup>
    <EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
</PropertyGroup>

in the project file

@rainersigwald
Copy link
Member

Duplicate of dotnet/msbuild#4740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants