c# - "are you missing a using directive or assembly reference?"我是还是不是?

标签 c# visual-studio-2017 .net-4.6.1

多次清理和重建所有内容,重新启动 VS 和计算机但没有任何进展。在修补 QueryCommander 开源项目中的一些错误时,我遇到了 Debug 构建但 Release 不构建的问题。我仅在 Release模式下出现此错误:

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

引用确实存在:

enter image description here

它确实包含缺少的命名空间:

enter image description here

单元 FrmHelpBrowser.cs 确实没有 using 指令,但我不确定为什么它在 Debug 模式下工作以及什么应该在这里使用:

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

Release模式缺少什么?

最佳答案

啊!原始项目中的引用是位于 bin\Debug 下的 DLL(查看引用属性窗口)。我删除了引用并使用解决方案根目录中的 AxInterop.SHDocVw.dll 添加了它 - 问题已解决!

关于c# - "are you missing a using directive or assembly reference?"我是还是不是?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44460026/

相关文章:

c# - MVC 5 IIS;在 web.config 之前使用 machine.config

c++ - 微软 Visual Studio 社区 2017 的 Graphics.h

c# - Visual Studio Intellisense 显示 "new expression can be simplified",但构建失败

command-line - Microsoft NuGet 针对从 Teamcity 构建项目时出现错误

c# - UpdatePanel 中的图像在 Firefox 中不起作用

c# - 从 Javascript 设置 Viewstate 的值

c# - 如何确定导致 Test Explorer 崩溃的异常?

visual-studio-2017 - Visual Studio 15编译失败-清理项目

c# - .NET Framework 4.6.1 的 Web.Config 版本

c# - 如何动态更新/添加项目到 IObservable<int> 中?