Gabriel Davidian
Gabriel Davidian

Reputation: 318

TeamCity includes dll as reference when building project

We have a project with included win32 dll as content file. This file (native32.dll) is copied to the output directory and imported at runtime. Visual studio compiles project without any problems, however TeamCity takes this .dll file (or any .dll file included in the project structure) and treats it as if it was a reference:

  csc.exe <..> /reference:native32.dll <..>

Build fails with error:

CSC error CS0009: Metadata file 'native32.dll' could not be opened -- PE image doesn't contain managed metadata

How can this native32.dll be excluded from being referenced?

Upvotes: 4

Views: 1787

Answers (1)

Filip Ekberg
Filip Ekberg

Reputation: 36287

You need to create a Class Library and include the DLL in that library, together with the wrapper/interop classes. Then just reference the class library from your other project that wouldn't compile before.

Upvotes: 1

Related Questions