How to force reference update?

J

John Lafrowda

Hi all,

I'm trying to handle two projects in one solution (.net 2002, both projects
are VB). The first project contains only some public constant definitions
(for the moment) and compiles into class libarary. The second one is builds
an executable which has a reference to the assembly of the first project to
retrieve global constant definitions. The whole thing works fine as long as
no definitions are changed in the library project.

In case definitions are changed in the library project, I would expect that
the executable project integrates these changes as it is set to be dependent
on the library project and hence always built as a second step. In reality,
however, the build operation of the executable project does not recognise
changes in the library. At this time, I found only three unsatisfying ways
to force an update of the reference:

a) Remove the reference to the library and re-add the reference.
b) Switch the current state of the "Copy Local" switch of the executable to
the other option: If it is currently set to "True", a modification towards
"False" will update the reference - the same is true when changing from
"False" to "True".
c) Shut down the .net environment and restart it - the reference will be ok
then.

Now, what I'm looking for is a way to automatically update the dependencies
in a solution build process, i.e. references of the second project to the
first one should be updated (at least) when I try to build the second
project. Az the moment it seems to rely on a (local?) assembly cache as long
as do not update the reference manually as described above.

Any ideas?

Best regards,

John
 
J

Jay B. Harlow [MVP - Outlook]

John,
I'm trying to handle two projects in one solution (.net 2002, both projects
are VB).
Does your one project reference the first project, or did you reference the
DLL itself?

I normally reference the project itself in VS.NET then VS.NET works out the
correct dependencies, via "Project - Add Reference - Project".

You can use "Project - Dependencies" in solution explorer to control which
project is dependent on which when you reference the DLL itself. However I
reference projects, so I have not verified this method works as expected.

Hope this helps
Jay
 
A

Armin Zingler

John Lafrowda said:
I'm trying to handle two projects in one solution (.net 2002, both
projects are VB). The first project contains only some public
constant definitions (for the moment) and compiles into class
libarary. The second one is builds an executable which has a
reference to the assembly of the first project to retrieve global
constant definitions. The whole thing works fine as long as no
definitions are changed in the library project.

Did you set the reference to the project or to the compiled file? If you set
it to the project (3rd tab in "add reference" dialog), the 2nd project
should always be up-to-date.
 
J

John Lafrowda

Thanks Jay,

referencing the project instead of the DLL solved the problem (although I
still do not understand why referencing the DLL didn't work since the
references were correctly set in the solution explorer).

Cheers,

John
 
J

Jay B. Harlow [MVP - Outlook]

John,
(although I
still do not understand why referencing the DLL didn't work since the
references were correctly set in the solution explorer).
Were the dependencies also set correctly?

Also I'm not sure that VS.NET bothers checking to see if the DLL changed? I
suspect it is assuming the DLL is external to the solution, hence it
"doesn't change" so there is no reason to check to see if it changes.
However I am only surmising...

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top