general strong name question

  • Thread starter Thread starter marcel
  • Start date Start date
M

marcel

Hi,
I have written a component in c#. But when I recompile this component,
all other apps which includes my component can not start correctly:
An exception "System.IO.FileLoadExceptio" occurred. Only when I
compiled the app (with the new version of my component) it works. Can
it be because my component are signed and has a strong name?
How can I compile a new version of my component without compile the
apps which includes my component?

Thanks for help!

marcel
 
Are you hard-coding the version number? If you create a new version of your
assembly, but the old version needs to keep running, change the version
number.

If you code a new version and you want your older apps to use it, make sure
you are interface compatible. Also make sure that, if you added any new
dependencies, that the dependent objects are also signed and strongly named.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
Hi,
the Version will be changed by every compiling, because I use the *
character.
E.g. [assembly: AssemblyVersion("1.0.0.*")].

I have read that there are a possibility to configure the used version
in the config file of the application which includes my assambly. Is
this right and how I can do this?

thanks a lot
marcel
 
Let me understand correctly. I'm pretty sure I see your problem.

Is this the situation? --

1. You have a project that compiles to a dll.
2. You are making file references (not project references) between other
visual studio projects and this compiled assembly. (in other words, the
other solution files do not contain this project, but the other projects do
refer to the location, on the hard drive, of this compiled assembly).
3. Each time you recompile this assembly, and attempt to run the other apps,
the attempt fails and you want to know why, and what you can do about it.

Correct?

Answer: When you compile an assembly, Visual Studio creates a "manifest"
which provides the name and version of every assembly that is referenced.
So, when you compile your applications, the are referring to a specific
version of your DLL. If you then recompile the DLL, without recompiling the
dependent applications, then the manifest of the assembly will provide an
old version number. The applications will generate an error when they
cannot find the correct assembly (with the correct version number) and will
fail.

The solution is one of four things:
Either
A) specify the version number, so that ever time you recompile, the same
version number is used, or
B) create a solution file that contains all the projects that depend on this
DLL. That way, when you recompile and change the version, you can recompile
the applications automatically,
C) create a make file or nant script that will recompile all the dependent
applications (basically, the same concept as (B) but external to Visual
Studio).
D) hard code the assembly binding information (needed to resolve the
assemblies) into the config files of the applications that use the
independent assembly.

Some very useful links:
http://blogs.msdn.com/suzcook/archive/2004/05/14/132022.aspx
http://community.sgdotnet.org/forums/5614/ShowPost.aspx


Hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
Back
Top