Results 1 to 3 of 3

Thread: [Resolved] [2005] Sharing or linking existing project files between projects

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    At my computer
    Posts
    187

    Arrow [Resolved] [2005] Sharing or linking existing project files between projects

    I'm sorry if this has been asked before, but I couldn't find it.

    I have created an application that uses a module which I'm constantly revising. I have also created a second project that uses the same module. However, when I attempt to add the module to the second project, it copies it into its own folder. I need it to be linked to the original module, like one could do in VB6... I don't want to have to make my changes twice or constantly be having to copy the module back and forth.

    Any way to do this?
    Last edited by Allen Schoessler; Apr 30th, 2006 at 06:10 PM.
    - Visual Basic 6.0
    - Windows XP Home

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    At my computer
    Posts
    187

    Re: [2005] Sharing existing project files between projects

    Solved it.

    For anyone wanting to do this in the future:

    Place the files where you want them to be. Add them to your project. They will be copied to the root of the solution. Close Visual Basic.NET. Open the projectname.vbproj file (found in the root) in Notepad. Do a search for the name of the file you want to be shared. You will see something like:

    VB Code:
    1. <Compile Include="modServer.vb" />
    2.     <Compile Include="modCommon.vb" />
    3.     <Compile Include="modINI.vb" />
    4.     <Compile Include="cRegistry.vb" />

    Change the reference to where you want them to point to, like so:

    VB Code:
    1. <Compile Include="modServer.vb" />
    2.     <Compile Include="..\modCommon.vb" />
    3.     <Compile Include="..\modINI.vb" />
    4.     <Compile Include="..\cRegistry.vb" />

    modServer remains in the current directory, while the other three are up a level. Delete the duplicate copies of the files in the root directory.

    Launch your project. The files which you modified the locations for will show up with a link arrow on them. Repeat for other projects that you want to share these files with.
    - Visual Basic 6.0
    - Windows XP Home

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [Resolved] [2005] Sharing or linking existing project files between projects

    I would suggest not doing that and simply creating a new class library project into which you can place the common code. You then reference the library from the application or library that requires it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width