Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 245
ceej Avatar asked Oct 07 '20 10:10

ceej


People also ask

What is a .EditorConfig file?

The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.

Does Vscode support EditorConfig?

EditorConfig for Visual Studio Code. This plugin attempts to override user/workspace settings with settings found in . editorconfig files. No additional or vscode-specific files are required.


2 Answers

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>
like image 110
Chris Sienkiewicz Avatar answered Sep 20 '22 00:09

Chris Sienkiewicz


The right pull request is this one -- it's built as a way for some MSBuild logic to pass values to certain Roslyn analyzers. This is internal implementation detail and shouldn't be checked in to source control.

I'm surprised you noticed this file though -- it should be generated into your obj\ directory, which you should already have excluded from source control and never really noticed in the first place. Did it get generated somewhere else?

like image 38
Jason Malinowski Avatar answered Sep 22 '22 00:09

Jason Malinowski