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

[Bug] Unable to compile a .NET Framework Class Library that references Microsoft.Identity.Client.Desktop #4660

Open
BenjaminAbbott opened this issue Mar 12, 2024 · 1 comment

Comments

@BenjaminAbbott
Copy link

BenjaminAbbott commented Mar 12, 2024

Library version used

4.59.0

.NET version

.NET Framework v4.7.2

Scenario

Attempting to compile a .NET Framework class library.

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

Trying to compile a .NET Framework 4.7.2 class library that references Microsoft.Identity.Client.Desktop v4.52.0 higher (I have been testing using v4.59.0) fails with the following error:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS2001	Source file 'C:\Temp\TestAssembly\obj\Debug\TestAssembly.AssemblyInfo.cs' could not be found.	TestAssembly	C:\Temp\TestAssembly\CSC	1	Active

Compilation works correctly against v4.51.0.

On further investigating, I have discovered that for some reason, using v4.52.0 higher adds the following to the csc.exe command line:

/embed:obj\Debug\TestAssembly.AssemblyInfo.cs

It is this switch is what is causing the failure.

Relevant code snippets

An example .csproj file that re-creates this problem:

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

  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <AssemblyName>TestAssembly</AssemblyName>
    <EnableDefaultItems>False</EnableDefaultItems>
    <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
    <OutputPath>bin\</OutputPath>
    <LangVersion>10.0</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Identity.Client.Desktop" Version="4.59.0" />
  </ItemGroup>

</Project>

Expected behavior

The class library should compille...(!)

Regression

4.51.0

Solution and workarounds

I have not been able to find any way to workaround this problem, despite spending several hours investigating the problem.

If you change the following:

<GenerateAssemblyInfo>False</GenerateAssemblyInfo>

to

<GenerateAssemblyInfo>True</GenerateAssemblyInfo>

then it does compile but the problem than manifests in any other assembly that references the test assembly...

@BenjaminAbbott BenjaminAbbott added needs attention Delete label after triage untriaged Do not delete. Needed for Automation labels Mar 12, 2024
@BenjaminAbbott
Copy link
Author

I should have looked through the open issues, as is a duplicate of #4485. I am going to leave this issue open for now, as it is a serious problem that is preventing me from upgrading our production code beyond v4.51.0.

@bgavrilMS bgavrilMS added bug P2 public-client and removed untriaged Do not delete. Needed for Automation needs attention Delete label after triage labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants