在项目中我引用了 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);
...
怎么了?
目标框架是.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/