References path not working

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Hello,

I work on many asp.net projects, so i made a general dll that is not
strong named. To use this dll in a project, a simply copy the dll in
the bin directory and references it using "browse...".

This works fine, but i want to avoid copying the dll in each bin of my
projects. So i created a new directory C:\MyDlls, and added this path
in the "References Path" settings of my projects.

Then i made a copy of the dll in C:\MyDlls, removed the dll in each
bin of my projects and i did a rebuild all of my projects.

However if i run a project the dll is not found, and it seems to
ignore the reference path C:\MyDlls. When i got the error that the
assembly is not found, i can see a list of paths where the project
tried to find the dll. These paths are including the bin directory,
the temporary ASP.NET files in the .NET framework but i don't see
C:\MyDlls in this list.

What am i doing wrong? Any help appreciated, thank you!

Matt
 
Are you using VS.NET?

If you are, then you you will need to re-reference the assemblies again so
that VS.NET knows where they are located. If you right-click on the
reference in the IDE and select the Property command, you will see an item
called "Copy local". This will allow VS.NET to copy the binary into the
"bin" folder. This is basically what you were doing but automatically.

There are ways to forced the binding to look in other places, I do not know
how though. But the default requires the assembly to be in the "bin"
folder.

Or you could just sign the assemblies since you need them for more than one
project.
 
Of course i'm using VS.NET, and i think i get it now. I thought the
references path was used also at runtime, not only when building the
project. So that's why it doesn't work.

The other solution is to make the dll strong named and register in on
the global assembly cache with gacutil. In my case it's a problem
because this dll is used on the server of my provider, so i would have
to ask them to register the dll everytime we modify it. Bad idea.

I guess using a local copy in the bin is the only solution in my case.
Anyone else has a better idea? Thanks!

Matt
 
Matt said:
Of course i'm using VS.NET, and i think i get it now. I thought the
references path was used also at runtime, not only when building the
project. So that's why it doesn't work.

The other solution is to make the dll strong named and register in on
the global assembly cache with gacutil. In my case it's a problem
because this dll is used on the server of my provider, so i would have
to ask them to register the dll everytime we modify it. Bad idea.

I guess using a local copy in the bin is the only solution in my case.
Anyone else has a better idea? Thanks!

Matt

You can use the "<probing />" element in your web.config file to specify a
folder the runtime should search for referenced assemblies. Search the docs
for "<probing> element" for details.

Good luck,
Ryan LaNeve
 
Back
Top