1

I am encountering an issue that seems identical to this one.

I have a VS 2008 solution that includes, among other things: (names changed for simplicity)

  • DLL A: A native C++, business logic DLL
  • DLL B: A C++/CLI wrapper for DLL A with a namespace of "Wrapper"
  • EXE: A C# WinForms GUI EXE project that (references DLL B)

When I build the EXE, VS gives me an error:

error CS0246: The type or namespace name 'Wrapper' could not be found (are you missing a using directive or an assembly reference?)

However:

The first linked question mentions something about a "duplicate definition of a compiler symbol", but I'm not sure what to look for in that sense.

Any ideas for what to try?

Community
  • 1
  • 1
Kohanz
  • 1,510
  • 16
  • 35

1 Answers1

0

I think I figured this out.

Some more background: before building, the entire solution is created using CMake. I use CMake to make some edits to the csproj file for the EXE to point it to the correct references, including DLL B.

Whenever I run CMake, the statically defined GUID for DLL B in the ProjectReference node of the csproj file gets out of sync with the newly generated GUID for the vcproj that outputs DLL B. This GUID mismatch causes DLL B not to be referenced at build time, even though it shows up in the list of references and there are no related warnings or errors.

The way I discovered this was by looking at the build output. In the call to csc.exe, there was no '/reference' entry for DLL B.

Now I need to find a way to keep these GUIDs in sync!

Kohanz
  • 1,510
  • 16
  • 35
  • @Kohnaz So how did you keep these GUID's in sync. Can you post the updated answer ? – Versatile Jun 02 '17 at 13:25
  • @Versatile Luckily I somewhat documented this in a related question (https://stackoverflow.com/a/15432733/931528), because my memory is quite hazy on this. There may well be better supported options nowadays with CMake + .NET. – Kohanz Jun 02 '17 at 15:55