4

While code reviewing I found the following in a csproj file:

<ItemGroup>
    <Content Include="ilmerge.internalize.exclude.txt" />
</ItemGroup>

No such file exists in my source code directories.
Though I find the file in ..packages..\content and ..\bin\Debug\
They all contain the a namespace (removed from this question) followed by an asterisk. ..Web.Api.*

I guess it stems from ILMerge but cannot say how.

I guess I can safely remove the ItemGroup element. Right?

Edit

Present theory is that the files comes from a badly written dependency that utilises ILMerge to not expose its own dependencies. During some rework we managed to make it do the opposite, expose everything, plus even the file ilmerge.internalize.exclude.txt was carried over.

The very question is still unanswered though - what the file does.

LosManos
  • 7,195
  • 6
  • 56
  • 107
  • It ought to configure the [ILMerge /internalize option](https://stackoverflow.com/a/14516655/17034). Exactly how you use ILMerge in your solution is hard to guess from the question, there are multiple ways with a lot of nuget packages out there. If you remove it and it turns out to be necessary then you ought to get a build error. – Hans Passant Oct 08 '18 at 12:32
  • @HansPassant Thx for the link. Except from that a project references ILMerge, I see no use of it. Since noone is using ILMerge, neither through C# nor through build script, I don't know why it creates a file and fills it with content with our namespace. I have noticed this file from autumn this year. Older stuff, with similar other projects have no such file. My first guess as that we had updated ILMerge and it contained new functionality but I have found no such documentation. – LosManos Oct 09 '18 at 10:10

1 Answers1

2

This comes into effect when you specify /internalize:ilmerge.internalize.exclude.txt flag for ILMerge - whatever type was public, becomes internal, except what is listed within ilmerge.internalize.exclude.txt. Internalizing Assemblies with ILMerge

This file allows you to set types/namespaces via regex which you want to leave access modifier as-is (public). That is in each line you can specify fully qualified name for type to exclude from internalization (NOT internationalization):

Namespace\.Typename
Namespace2\..*

Not escaping dot will also work as within regex, a dot means any char.

You may want to see MSBuild output log whether your project uses ILMerge somehow.

Janis Veinbergs
  • 6,907
  • 5
  • 48
  • 78