Operation is not valid due to the current state of the object.
I'm getting the following error when trying to merge assemblies:
Merging 32 assembies to 'c:\work\dev\test1\project1\bin\Debug\\project1.dll'. (TaskId:102)
c:\work\dev\test1\project1.csproj(547,6): error : Operation is not valid due to the current state of the object.
But there's no other helpful information associated with the error. There's no log file (ex. %temp%\MSBuild_*.failure.txt)
Any ideas?
I expected a more specific error that indicates which assembly failed to be merged so that I can possibly exclude it from being internalized.
<!-- ILRepack -->
<Target Name="AfterBuild">
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\*.dll" />
</ItemGroup>
<ILRepack
Parallel="true"
Internalize="true"
InputAssemblies="@(InputAssemblies)"
TargetKind="Dll"
ZeroPeKind="true"
Verbose="true"
OutputFile="$(OutputPath)\$(AssemblyName).dll" />
</Target>
<!-- /ILRepack -->
Thank you.
For my specific case, I had to set Internalize="false" but I still don't understand why.
I hit this issue as well. If you don't wildcard the InputAssemblies it also works
In my case this occurs when trying to include EntityFramework dll's
Any update on this issue. Cause I am hitting the same error on dapper.extensions
Also getting this, but none of the previous suggestions worked for me. I removed ILRepack.
Same. I'm going to have to punt ILRepack.
Same. Works for my DLLs, fails once I include EntityFramework 6.0.0 regardless of internallize true/false, wildcard, etc.
'+ 1. Same error and no ideas why
Faced this issue today. Removed this packages and added ILRepack.2.0.15 nuget package which has ILRepack.exe and used exec "exec" task in csproj to the the job. No more such issue!
Can confirm that ditching this project and invoking ILRepack.exe explicitly works fine.
Is this project even being maintained?
@nullpainter I can recommend this one https://github.com/ravibpatel/ILRepack.Lib.MSBuild.Task
I can recommend this one https://github.com/ravibpatel/ILRepack.Lib.MSBuild.Task
@FixRM that works beautifully. Thank you!
Closing this issue. I've made significant changes to the build task in order to support netstandard2.0 and netcoreapp. Please do check it out.