“are you missing a using directive or assembly reference?” Am I or am I not?

十年热恋 提交于 2019-12-10 18:15:10

问题


Cleaned and rebuilt everything many times, restarted VS and computer but no progress. Patching some bugs in the QueryCommander open source project, I came across an issue where Debug builds, but Release does not. I get this error in Release mode only:

CS0246  The type or namespace name 'AxSHDocVw' could not be found (are you missing a using directive or an assembly reference?)
QueryCommander.Help C:\Workspace\QueryCommander_4_0_0_0\QueryCommander.Help\WinGui\FrmHelpBrowser.cs

The reference does actually exists:

And it does contain the missing namespace:

The unit FrmHelpBrowser.cs does not have a using directive indeed, but I am not sure why that works in Debug mode and what should be used here:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using QueryCommander.Help.WinGui.Base;

namespace QueryCommander.Help.WinGui
{
    /// <summary>
    /// Summary description for FrmHelpBrowser.
    /// </summary>
    public class FrmHelpBrowser : FrmBaseContent
    {
        public AxSHDocVw.AxWebBrowser axWebBrowser1; // Error on this line
//----------------^ here

What is missing in the release mode?


回答1:


Argh! The reference in the original project was to the DLL sitting under bin\Debug (looking at the reference properties window). I deleted the reference and added it using the AxInterop.SHDocVw.dll in the solution's root directory - problem solved!



来源:https://stackoverflow.com/questions/44460026/are-you-missing-a-using-directive-or-assembly-reference-am-i-or-am-i-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!