1
votes

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?

1
Did you add a reference to the DLL B project from the EXE project? (You said all references resolve, but you didn't enumerate 'all'.)David Yaw
@DavidYaw I figured it out - please see my answer.Kohanz

1 Answers

0
votes

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!