Skip to content

Arcade forcing .config files to be generated for DLLs targeting net472 #9305

@jaredpar

Description

@jaredpar

Consider this part of WorkAround.targets

  <!-- Workaround for https://github.com/Microsoft/msbuild/issues/1310 -->
  <Target Name="ForceGenerationOfBindingRedirects"
          AfterTargets="ResolveAssemblyReferences"
          BeforeTargets="GenerateBindingRedirects"
          Condition="'$(AutoGenerateBindingRedirects)' == 'true'">
    <PropertyGroup>
      <!-- Needs to be set in a target because it has to be set after the initial evaluation in the common targets -->
      <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
  </Target>

This effectively forces $(GenerateBindingRedirectsOutputType) to true whenever $(AutoGenerateBindingRedirects) is true. MSBuild though made a change that defaults $(AutoGenerateBindingRedirects) to true whenever a project targets net472 or a later .NET Framework TFM. Together this means that when using arcade and targeting modern .NET Framework TFM it is generating app.config files even though that is likely not the intent of the author.

If you want to get a sense of the confusion this can cause consumers as well as MSBuild team members you can look at the following internal conversation

https://teams.microsoft.com/l/message/19:3212bf033f4c4b5198643a04fa1048fa@thread.skype/1652138528354?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=4ba7372f-2799-4677-89f0-7a1aaea3706c&parentMessageId=1652138528354&teamName=.NET%20Developer%20Experience&channelName=MSBuild&createdTime=1652138528354

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions