Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Compilers/Core/MSBuildTask/Microsoft.Managed.Core.targets
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@

<GlobalAnalyzerConfigFiles Include="@(_AllDirectoriesAbove->'%(FullPath)'->Distinct()->Combine('.globalconfig'))" Condition="'$(DiscoverGlobalAnalyzerConfigFiles)' != 'false'" />
<EditorConfigFiles Include="@(GlobalAnalyzerConfigFiles->Exists())" Condition="'$(DiscoverGlobalAnalyzerConfigFiles)' != 'false'" />

<EmbedInBinlog Include="@(EditorConfigFiles)" />
</ItemGroup>

<!--
Expand Down Expand Up @@ -192,6 +194,7 @@
<!-- Record that we'll write a file, and add it to the analyzerconfig inputs -->
<FileWrites Include="$(GeneratedMSBuildEditorConfigFile)" />
<EditorConfigFiles Include="$(GeneratedMSBuildEditorConfigFile)" />
<EmbedInBinlog Include="$(GeneratedMSBuildEditorConfigFile)" />
</ItemGroup>

<!-- Transform the collected properties and items into an editor config file -->
Expand Down
24 changes: 24 additions & 0 deletions src/Compilers/Core/MSBuildTaskTests/TargetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,30 @@ public void GenerateEditorConfigIsPassedToTheCompiler()
Assert.Single(items);
}

[Fact]
public void GenerateEditorConfigIsEmbeddedInBinlog()
{
XmlReader xmlReader = XmlReader.Create(new StringReader($@"
<Project>
<Import Project=""Microsoft.Managed.Core.targets"" />

<ItemGroup>
<CompilerVisibleProperty Include=""prop"" />
</ItemGroup>
</Project>
"));

var instance = CreateProjectInstance(xmlReader);

bool runSuccess = instance.Build(target: "GenerateMSBuildEditorConfigFile", GetTestLoggers());
Assert.True(runSuccess);

var editorConfigItems = instance.GetItems("EditorConfigFiles");
var embedInBinlogItems = instance.GetItems("EmbedInBinlog");
Assert.Single(editorConfigItems);
Assert.Contains(embedInBinlogItems, item => item.EvaluatedInclude == editorConfigItems.Single().EvaluatedInclude);
}

[Fact]
public void AdditionalFilesAreAddedToNoneWhenCopied()
{
Expand Down
Loading