Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
|
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2008, 04:57 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default Question about adding references in vs2008

Hi

I am wondering when you add a reference that is not part of the references in vs2008(ie it is a custom file that you say dled from the net/made and added to your project).

Where does it add the file? Like does it add it someone where in the project? Like you know when you add an existing file into vs2008 it actually copies the file to the folder that contains your project.

I am asking this because I had the .dll file that I dled on the net saved on my desktop, I then added it as a reference in my project. I then committed my project to subversion.

Later I went to a different computer and got my version from subversion and the .dll was not with my program and it was complain about this.

So do I have to make my own folder up in my project and call it references or what?

Thanks

 
Old December 4th, 2008, 05:09 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Typically it is a good idea to play your DLL References into your /bin directory. What may have happened is that Visual Studio created a .refresh file (all this file contains is a path to where the dll is located) and when you attempted to open the project on another PC the refresh would of been pointing to something like C:\Documents and Settings\User\Desktop\file.dll which wouldnt of existed on the second PC.

This is purely speculation of course but I imagine that is what happened in this case.

-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old December 4th, 2008, 05:12 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

Quote:
quote:Originally posted by dparsons
 Typically it is a good idea to play your DLL References into your /bin directory. What may have happened is that Visual Studio created a .refresh file (all this file contains is a path to where the dll is located) and when you attempted to open the project on another PC the refresh would of been pointing to something like C:\Documents and Settings\User\Desktop\file.dll which wouldnt of existed on the second PC.

This is purely speculation of course but I imagine that is what happened in this case.

-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========

So you think just making a folder called references in the bin directory and then just still all my references in there?

 
Old December 4th, 2008, 05:21 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What VS *should* have done was pulled the dll into your bin directory when you first added the reference; it would have then created a refresh file (which would of also have been in the bin). If you want to create a References folder inside of your bin thats fine, I typically don't go to the trouble since my bin's aren't typically littered with enough dll's to warrant seperate directories but that is a matter of personal preferance i suppose.

hth.
-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old December 4th, 2008, 07:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Just a thought on the seperate references folder idea. VS will write all of your binaries (exe's, referenced custom dll's) to the same folder when you build your project. This is the folder specified in the Build properties dialog "Output path" property. The default is "bin\Release\" or "bin\Debug" depending on your build type.

If you want to move your custom dll references to a folder other than the default bin folder when you deploy, you will need to add a configuration file to your app to tell the CLR where to look for it. When the CLR needs to locate an assembly is scans subdirectories in the following order:

AppBase(usually 'bin')\AssemblyName.dll
AppBase(usually 'bin')\AssemblyName\AssemblyName.dll
AppBase(usually 'bin')\privatePath\AssemblyName.dll

Adding a seperate references folder (private path) to hold your referenced custom dll's in your deployed app would require adding a configuration file to the folder your app is running in (AppBase)that would look like:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="references"/>
    </assemblyBinding>
  </runtime>
</configuration>
The name of the configuration file has to be the name of the applications main assembly file with a .config extension like:

Main assembly file - Test.exe
Config file- Test.exe.config

Bob






Similar Threads
Thread Thread Starter Forum Replies Last Post
vba question on adding certain columns csilla Excel VBA 0 July 30th, 2008 05:25 AM
Adding references and scope issues Artfuldodger C# 2 July 1st, 2008 01:56 PM
Adding code question zoidberg BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 5th, 2006 02:25 PM
Adding Web References to a project.... vb_developer C# 0 September 5th, 2004 01:32 AM
Adding References mahulda ASP.NET 1.0 and 1.1 Basics 0 May 20th, 2004 11:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.