il-repack icon indicating copy to clipboard operation
il-repack copied to clipboard

reference errors when using command line vs ilrepack.msbuild.task

Open grounded042 opened this issue 8 years ago • 3 comments

When I package my dll using command line, I don't get any errors, but upon referencing the new DLL in a project, at build I get errors. However in VS, those errors show up during build but disappear when I go to where they are. Here is an example on lines 266+ https://ci.appveyor.com/project/highlyunavailable/consuldotnet/build/0.6.3.241-master

The command line arguments I am using for the above build can be found on line 247: C:\consul\packages\ILRepack.2.0.10\tools\ILRepack.exe /keyfile:C:\consul\Consul\..\assets\consuldotnet.snk /parallel /internalize /out:C:\consul\Consul\bin\Release\Standalone\Consul.dll C:\consul\Consul\bin\Release\Consul.dll C:\consul\Consul\bin\Release\Newtonsoft.Json.dll and the output from that can be seen on lines 248-260

If I pack this with ilrepack.msbuild.task, I get no errors after packing and everything works fine: https://ci.appveyor.com/project/highlyunavailable/consuldotnet/build/0.6.3.242-master

grounded042 avatar Apr 29 '16 14:04 grounded042

Hi,

TL;DR: add a space in your InternalsVisibleTo declaration, needs to be , PublicKey=...

Long(er) version, this highly NASA-grade-quality code expected the attribute to be specified using the standard way and you tricked it :smiling_imp:

(PR welcome to fix that)

Probably the task is using an old version of ILRepack which didn't perform this processing (#45). Tricked-ILRepack removed the visibility attribute from your merged assembly, and the compiler (rightly-so) can't find the (internal) extension methods any longer from the UT project.

Hope it helps.

gluck avatar Apr 29 '16 16:04 gluck

👍 I was scratching my head all day trying to figure out what was going wrong. Thanks!

grounded042 avatar Apr 29 '16 19:04 grounded042

PR submitted!

grounded042 avatar Apr 29 '16 20:04 grounded042