Question

I'm trying to get ILMerge working with a SL 4 class library (no xaml).

I have a post build task:

 <Target Name="AfterBuild">
    <CreateItem Condition="'%(Extension)'=='.dll'" Include="@(ReferenceCopyLocalPaths)">
      <Output TaskParameter="Include" ItemName="IlmergeAssemblies" />
    </CreateItem>
    <Exec Command="&quot;$..\..\..\References\Ilmerge.exe&quot; /ndebug /targetplatform:v4,&quot;C:\Program Files (x86)\Microsoft Silverlight\4.0.50917.0&quot; /internalize:&quot;$..\..\ILMergeInclude.txt&quot; /keyfile:&quot;$..\..\..\References\StrongName.pfx&quot; /out:&quot;@(MainAssembly)&quot; &quot;@(IntermediateAssembly)&quot; @(IlmergeAssemblies->'&quot;%(FullPath)&quot;', ' ')" />
    <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
  </Target>

At first I got an error about an unresolved assembly reference to System.Core, but I read about having to add the /targetPlatform switch. That got rid of that error, but now with the task above, I get:

An exception occurred during merging:
  Unable to load DLL 'mscorsn.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Anyone have any luck with this?

Thanks.

Was it helpful?

Solution

Switching to use an snk instead of a pfx fixed the problem. Bizarre.... Thanks M Barnett!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top