I have the following code in project1 that is calling a class from project2.
Project1 is calling:
ConvertDocument.Convert(CommandLineFile, “d:\testing\test.pdf”, WdSaveFormat.wdFormatPDF);
Project 2 contains ConvertDocument and WdSaveFormat is from Microsoft.Office.Interop.Word that is referenced in project2.
When I try to pass the enum value to project2 with the above code, it gives me:
Cannot resolve symbol “WdSaveFormat”.
My question is, can I reference that enum in project2 that is referencing Microsoft.Office.Interop.Word from Project1 without having to add the reference?
I hope that makes sense…
Thanks again!
The best solution is to create your own type to marshal parameters between libraries and projects.
Do NOT require communications between projects to know about 3rd party libraries (unless they will always be tightly coupled in this manner). It is much better to create your own types to marshal between project libraries. Then the receiving project (callee) will translate from your custom type to the 3rd party library type.
In this scenario, Project 1 will use a custom enum known by both project 1 and 2. Project 1 will use this enum to talk with project 2 who will translate it into the correct 3rd party type.
For instance (this is rough pseudocode):