roslyn: Project.AssemblyName does not accurately report assembly name.

This issue has a corresponding ticket on Developer Community. Please vote and comment there to make sure your voice is heard.


The following code suddently started appending “.csproj” onto assembly names which seems wrong.

private IReadOnlyList<string> GetTargetAssemblies()
{
    List<string> result = new List<string>();

    foreach (Microsoft.CodeAnalysis.Project project in this.workspace.CurrentSolution.Projects)
    {
        // .Net Core projects can have ".csproj" attached sometimes.
        result.Add(project.AssemblyName.Replace(".csproj", string.Empty));
    }

    return result.AsReadOnly();
}

It is important to keep apis reporting data in a consistent format. if it doesn’t it requires rolling out extension updates for no useful reason.

Here is the csproj that causes the assembly name to be wrong:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <AssemblyName>Microsoft.Exchange.Diagnostics</AssemblyName>
  </PropertyGroup>
</Project>

Note: I must have <AssemblyName> in this new format project because there is no other way (known? supported?) to find the target assembly programmatically between old and new format csproj files.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 28 (28 by maintainers)

Commits related to this issue

Most upvoted comments

@nschuessler I believe you are working on this?

I’m gonna give it a try, yes.