简体   繁体   中英

C++/CLI CS0246: The type or namespace name 'Wrapper' could not be found

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: AC# 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?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM