"LINK : fatal error LNK1168" - C# app using C++ implemented COM object
Same problem was asked about here, but with no response, in Nov 2005:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=132351&SiteID=1Anyway, I have a solution that contains two projects. One generates a DLL containing a few COM objects implemented with unmanaged C++. Another is a C# application which makes use of those objects. At this point I repeatedly have to restart Visual Studio 2005 if I've made changes to the C++ code because it will not link:
LINK : fatal error LNK1168: cannot open Debug\MyModule.dll for writing
The culprit holding the module is devenv.exe (so says SysInternals Process Explorer).
So long as I'm not changing the C++ code, this isn't much of a problem, but having my work flow include the step "restart visual studio" before building the solution is really putting a dent in my day.
Anyone have any solution to this?
For some reason I mistakenly though I already had SP1 installed, but did not. So I'm downloading it now and will report back whether it makes any difference at all.
EDIT:
SP1 makes absolutely no difference at all. Same problem exists.
Also:
- No, the object browser is not open.
- Having the C# project reference the TLB instead of the DLL directly does not make a difference.
- The reference in the C# project has "Copy Local" set to True. (If its set to false, devenv loads my C++ DLL as soon as the project loads)
- No, the two projects do now share output directories.
The resolution section of that KB article says:
"Once the control is added to the dialog box in the resource editor, close the property window and restart the integrated development environment (IDE). After you restart the IDE, do not open the property window for the control. If you do need to open the property window after you have restarted the IDE (such as to make some changes to the properties of the control), you must close the window and restart the IDE again before you compile."In my case, the control is not in a dialog box, nor do I avoid the problem by not opening the property window. So unfortunately this is still unresolved (though I don't do much work with the solution in question anymore so its somewhat moot for now).