0

I'm working on an integration test harness that offers developers the ability to execute methods either against our integration database or against a SQLite in-memory database.

Because none of the actual SQLite code is referenced by my harness, I have to add dummy code to ensure that msbuild copies the DLLs:

namespace References {
    internal interface IReferenceUnusedDependencies {
        SQLiteException e { set; } // Reference System.Data.SQLite.dll
        IMappingEngineRunner r { set; } // Reference AutoMapper.dll
    }
}

However, I can't figure out how to reference code from System.Data.SQLite.Linq.dll - all of the classes and interfaces it contains are internal.

Is it possible to make these references somehow?

Matt Mills
  • 8,692
  • 6
  • 40
  • 64

1 Answers1

0

Add this assembly property to your main project

using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo( "MyTestDLLName" )]

Re-reading the problem, do you simply need to copy the referenced assemblies to your bin?

If so you can choose the copy to property in Visual studio (which in turn uses MSBuild) under the Item's Properties from the Solution explorer.

Select the reference in the References folder, and then choose copy local. (Other MSBuild properties are available there as well)

James
  • 2,445
  • 2
  • 25
  • 35
  • To `System.Data.SQLite.Linq`? – Matt Mills Jul 03 '12 at 15:09
  • But doesn't that only apply to your assemblies? What if it is a third-party assembly? Same deal? – Jeff Mercado Jul 03 '12 at 15:09
  • @JeffMercado yes this is for external assemblies you want to explicitly have access to your internals – James Jul 03 '12 at 15:12
  • @arootbeer this goes in whatever assembly has the internals you want to make visible to external assemblies – James Jul 03 '12 at 15:13
  • 2
    Ok but **what if it is a third-party assembly**? You can't just apply attributes willy-nilly to any assembly, if it's not your code, you can't do anything about it (AFAIK). – Jeff Mercado Jul 03 '12 at 15:16
  • @JeffMercado Ah my apologies, I misread the question. You can use reflection as outlined in a duplicate question here (http://stackoverflow.com/questions/920844/c-sharp-how-to-access-internal-class-from-external-assembly) – James Jul 03 '12 at 15:20