Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Reference Not Being Copied Over In Multiple Project Environment

I have a solution file in VS 2010 and it has multiple projects in it.

Now, I have a reference to this dll call MySql.Data.Entity.dll.

As an example, I have the following projects setup in the solution:

  • Domain (reference to MySql.Data.Entity.dll)
  • Domain.Test (reference to the project "Domain")

I want that Domain.Test to copy over all the references from Domain, so I set the Property on that dll to "Copy Local - True". It did not copy over to the Domain.Test project.

I have encounter this problem from before with over dlls. What I did was this:

namespace Domain.Helpers
   {
        /// <summary>
        /// To trick VS to deploy required assemblies
        /// </summary>
        class BuildTricker
        {
            public void AssemblyTricker()
            {
                new LinFu.DynamicProxy.CallAdapter(null);
                new NHibernate.ByteCode.LinFu.ProxyFactory();
            }
        }
    }

And worked fine. If I "use" the class it will know to copy it over to "Domain.Test".

Problem with this is that there is nothing I can initialize/"use" from this MySql.Data.Entity.dll.

Note: Just adding the namespace in a Using statement won't do the trick, you HAVE TO "use" a class in the dll for it to be copied over.

I am currently manually referencing this dll into all the projects that requires it.

So, my question is. Is there something wrong with my configuration? Or is this a VS limitation?

Thanks,

Chi

like image 572
Chi Chan Avatar asked Oct 26 '10 22:10

Chi Chan


People also ask

How do I fix missing references in Visual Studio?

To fix a broken project reference by correcting the reference path. In Solution Explorer, right-click your project node, and then select Properties. The Project Designer appears. If you're using Visual Basic, select the References page, and then click the Reference Paths button.

How do you add a project as a reference of another project?

You can also right-click the project node and select Add > Project Reference. If you see a References node in Solution Explorer, you can use the right-click context menu to choose Add Reference. Or, right-click the project node and select Add > Reference.


1 Answers

That's the catch with COMReferences, they're not resources, so they don't get copied.

By setting the reference to MySql.Data.Entity.dll's Isolated property to True, the file is copied over from its original location to your "Domain" project's bin folder and finally to your "Domain.Test" project's bin folder.

like image 135
MPelletier Avatar answered Oct 04 '22 22:10

MPelletier