Correct way to call aspnet_merge.exe

18 January 2011

When executing aspnet_merge.exe to merge the compiled assemblies in a web site, I got the following error:

An error occurred when merging assemblies: ILMerge.Merge:  There were errors reported in App_Web_ngsd3smh's metadata.
Module or assembly depends on a version of core library that is newer than the one the Reader uses to resolve system types.

I triple checked the assembly in question and all related assemblies and they were all 4.0 ones.

I found nothing about this error on the web, that's because it was my own stupidity.

I used PowerShell with a current working directory of:

[C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools]

and started the command with

aspnet_merge.exe C:\precompiledSite -o targetassembly.dll

The problem was that I have the 2.0 Version of aspnet_merge.exe in my tools directory
which is also in the path. So the command above executes the old version, hence the errors.

The correct call is of course:

.\aspnet_merge.exe C:\precompiledSite -o targetassembly.dll

Pages in this section

Categories

ASP.Net | Community | Development | IIS | IT Pro | Security | SQL (Server) | Tools | Web | Work on the road | Windows