TypeLoadException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I have an EXE that is using a sub assembly.
When I compile the EXE and distribute it to a device it is all working fine,
but if I recompile the DLL again and distribute it to the PDA it gives an
error;

TypeLoadException Cannot load type "xyz" from abc, Version 2.2.7.28333

This is the version of the assembly that the EXE was compiled against, but
now the assembly on the PDA has a Version 2.2.7.28506.

My assemly is not strongly named so i dont know why it is checking for the
version of the sub assembly when loading at runtime.

What am i doing wrong?

Cheers,
James
 
In that case, maybe it would be better to modify the following line in
AssemblyInfo.cs from:

[assembly: AssemblyVersion("2.2.*")]

to

[assembly: AssemblyVersion("2.2.0.0")]
 
Hi Sergey,

I think it would still be useful to know the build number of the component
but i dont want the CLR to consider version number when loading and assembly
@ runtime.

Cheers,
James.

Sergey Bogdanov said:
In that case, maybe it would be better to modify the following line in
AssemblyInfo.cs from:

[assembly: AssemblyVersion("2.2.*")]

to

[assembly: AssemblyVersion("2.2.0.0")]


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

Hi all,

I have an EXE that is using a sub assembly.
When I compile the EXE and distribute it to a device it is all working fine,
but if I recompile the DLL again and distribute it to the PDA it gives an
error;

TypeLoadException Cannot load type "xyz" from abc, Version 2.2.7.28333

This is the version of the assembly that the EXE was compiled against, but
now the assembly on the PDA has a Version 2.2.7.28506.

My assemly is not strongly named so i dont know why it is checking for the
version of the sub assembly when loading at runtime.

What am i doing wrong?

Cheers,
James
 
Well, I found out that the Assembly is defining it's version number as

[assembly: AssemblyVersion("2.2.*")]

Which when set to

[assembly: AssemblyVersion("2.2.7.*")]

Fixes the problem.... BUT... I dont know why it is checking the version
number anyways. I read somewhere that if the Assembly has a non-null public
key then the assembly should check the version number (except for the
revision #). But we did not specify a public key for the assembly.
Is the key implicitly set?
Is there a way to explicitly tell the Assembly not to have a public key?

CHeers,
James.
 
The netcf treats versions differently to the full framework.

When recompiling, your dll must preserve major.minor.build no matter what.

The only (ugly) workaround is to set the version to 0.0.0.0 and then version
checking is skipped altogether...

Cheers
Daniel
 
Back
Top