c# - 缺少引用

标签 c# reference

在项目中我引用了 Microsoft.Office.Word.Server 在代码中我有方法接受类型为 ConversionJob 的参数,但是当我尝试编译它时出现错误

The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)    


The type or namespace name 'ConversionJob' could not be found (are you missing a using directive or an assembly reference?) 

但是当在 ConversionJob 上按 f12 时,我进入了类定义

using Microsoft.Office.Word.Server.Service;
using Microsoft.SharePoint;
using System;

namespace Microsoft.Office.Word.Server.Conversions
{
    public class ConversionJob
    {
        public ConversionJob(WordServiceApplicationProxy serviceApplicationProxy, ConversionJobSettings settings);
        public ConversionJob(WordServiceApplicationProxy serviceApplicationProxy);

...

enter image description here

怎么了?

目标框架是.Net framework 3.5

解决方案
我解决了这个问题。我查看输出,有消息:

Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "<assembly reference>" could not be resolved because it has an indirect dependency on the framework assembly "<assembly" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "<assembly>" or retarget your application to a framework version which contains "<assembly>"

我尝试在谷歌中找到解决方案 -> http://www.sanderstechnology.com/2011/warning-msb3268-you-are-about-to-experience-pain/10646/#.TtYrXGP20Z8

最佳答案

检查您的应用程序的目标框架,您可能正在为客户端配置文件构建但引用的程序集需要完整的框架。

关于c# - 缺少引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8314109/

相关文章:

c# - Thread.Sleep 会影响 ThreadPool 吗?

c# - Socket.Close 并没有真正关闭 tcp 套接字? (C#)

c# - C#中的字符串相等问题

c++ - 是否可以使用 'using' 来声明对 3 个整数类型别名的引用?

reference - 为什么我可以返回对本地文字的引用,而不是对变量的引用?

c# - 强制按值传递引用类型(或 .Clone()d on Pass)

c# - Oracle 找不到类型或命名空间名称 缺少指令

c# - 只打印数据库第一行的数据而不是整个表

c# - 如何将自定义日志存储在使用diagnostics.wadcfg创建的Azure本地存储中

reference - 当结构及其成员具有不同的生命周期时理解 Rust 中的引用