Skip to content

Run tests with custom DLL locations #450

Open
@peakschris

Description

@peakschris

Hi there,

We are trying to get csharp_nunit_test working with a particular dotnet library in our product that has some interesting requirements. Let's call it business.dll. At runtime, business.dll looks for a folder named 'plugins' (relative to directory containing business.dll) and loads all DLLs inside that directory.

The source layout is:

src\dotnet\business\BUILD.bazel (business.dll)
src\dotnet\plugin1\BUILD.bazel (plugin1.dll)
src\dotnet\plugin2\BUILD.bazel (plugin2.dll)
src\dotnet\tests\BUILD.bazel(test)

The test is:

csharp_nunit_test(
    srcs = glob(["*.cs"]),
    deps = [
         "//src/dotnet/business",
         "//src/dotnet/plugin1",
         "//src/dotnet/plugin2",
    ],
)

The issue is, at runtime, the plugin DLLs are located in a mirror of their src tree locations instead of in a plugins subdirectory at the same parent directory of business.dll

I have tried using aspect copy_file and copy_to_directory to move the DLLs around and then make the test depend on the copied targets, but this does not seem to work

What is the correct way to get this working? I can't edit the code inside business.dll - should not put bazel logic inside our product.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions