You receive a "fatal error C1192" error message when you build a Visual C++ .NET 2003 application in Release mode (843407)
The information in this article applies to:
- Microsoft Visual C++ .NET (2003)
SYMPTOMSWhen you add a reference to an assembly by using the Add
Reference dialog box in a Microsoft Visual C++ .NET 2003 application, and then you build the application in Release mode, you
receive an error message that is similar to the following: fatal error C1192: #using failed on
'c:\myproject\myapp\debug\MyDll.dll' CAUSEThe compiler searches for the referenced assembly in the
Debug folder. However, the assembly is located in the Release folder when you
are working in Release mode. Therefore, the behavior that is mentioned in
the "Symptoms" section occurs.WORKAROUNDTo work around this behavior, use one of the following methods: - Use the #using statement to add the reference to the
assembly.
- Specify the assembly search path in the project
properties.
Use the #using statement to add the reference to the assembly- In Solution Explorer, expand MyApp, and
then expand References.
Note MyApp is a placeholder for the name of your Visual C++ .NET 2003
application. - Right-click MyDll under
References, and then click Remove.
Note MyDll is a placeholder for the name of your referenced assembly. - In Solution Explorer, right-click MyApp,
and then click Project Dependencies. The Project
Dependencies dialog box appears.
- In the Project Dependencies dialog box,
click MyApp in the Projects list, and then
click to select the MyDll check box under Depends
on.
- Click OK.
- In Solution Explorer, expand Source Files
under MyApp.
- Right-click MyApp.cpp, and then click
Open. The code view of the MyApp.cpp file opens.
- Locate the following code:
#using <mscorlib.dll> - Add the following code after the code that you located in
step 8:
#using "MyDll.dll" - On the Build menu, click Build
Solution.
Specify the assembly search path in the project properties- In Solution Explorer, expand MyApp, and
then expand References.
- Right-click MyDll under
References, and then click Remove.
- In Solution Explorer, right-click MyApp,
and then click Properties. The MyApp Property
Pages dialog box appears.
- In the left pane, click C/C++, and then click
General.
- In the Resolve #using References box, type
C:\MyProject\MyApp\Release.
- Under C/C++, click
Advanced, and then type MyDll.dll in
the Force #using box.
- In the MyApp Property Pages dialog box,
click OK.
- On the Build menu, click Build
Solution.
STATUS This
behavior is by design.REFERENCES
For more information about how to add references, click the following article number to view the article in the Microsoft Knowledge Base:
310674
How to add references to a Managed Visual C++ project
Modification Type: | Minor | Last Reviewed: | 1/5/2006 |
---|
Keywords: | kbtshoot kbDLL kberrmsg kbprb KB843407 kbAudDeveloper |
---|
|