roslyneditorconfig

New generated GeneratedMSBuildEditorConfig file since recent upgrade


I have been upgrading a project and since the latest version of Visual Studio 2019 was installed have found the following file being output to disk

MyProjectName.GeneratedMSBuildEditorConfig.editorconfig

I think that this is related to the roslyn compiler and was introduced in this commit: https://github.com/dotnet/roslyn/commit/de348c5a77977459a4138de0a62487e00980e28a#diff-e87b4990385fcfea8cf3f744bb8ad23e

The obvious questions have arisen as to what this file is, what it does and whether it should be in source control or excluded. I know what .editorconfig files are for but this one was unexpected. My searching has turned up nothing. Can anyone shed any light on this?


Solution

  • Update: This is fixed in Visual Studio 16.9 and higher.


    There is a bug when using legacy/non SDK-style projects, which causes these files to be output to the wrong location. We have a fix out for this here: https://github.com/dotnet/roslyn/pull/48781

    In the interim as a workaround you can set the generated file output path explicitly by adding the following to your project file

    <PropertyGroup>
        <GeneratedMSBuildEditorConfigFile>$(IntermediateOutputPath)\$(MSBuildProjectName).GeneratedMSBuildEditorConfig.editorconfig</GeneratedMSBuildEditorConfigFile>
    </PropertyGroup>