2011-11-29 99 views
3

在項目中,我有參考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就tooks我到類defenition

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

+0

最近你做了一個乾淨的構建嗎? –

+0

是的,我嘗試首先清理,然後構建所有解決方案 –

回答

6

檢查應用程序的目標框架,可能是客戶端配置文件you're建設但引用的程序集需要完整的框架。

+0

目標框架是.Net框架3.5 –

2

嘗試改變 「目標框架」 是 「.NET Framework 4" 的,而不是」 .NET框架4客戶端配置文件」。

項目屬性 - >應用程序選項卡 - >目標框架

enter image description here

+0

它具有.net框架3.5,而不是客戶端配置文件 –

0

您可能需要刪除(請務必對其進行備份)的12.xxx .dll文件在您的GAC文件夾,並確保您在解決方案中引用了14.xxx。

+0

在程序集屬性中我有:path - C:\ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 14 \ ISAPI \ Microsoft.Office.Word.Server。dll和版本14.0.0.0 –

0

如果你看項目引用,它是否找到程序集?如果圖標無法解決,圖標看起來會有所不同。

+0

是的,它發現程序集,我也檢查它的磁盤。圖標是正常的,沒有帶「!」的黃色三角形 –

0

1.Try刪除,然後manualy添加引用(有時它幫助 - VS中迷失所需的dll,但不與另一個跡象,如果不乾淨表現出來)

  1. 如果1 OK,然後備份,並嘗試從GAC文件夾中刪除(以便從其調用組件的地方刪除)
0

也許您的代碼中有某個名稱爲Office的名稱空間或類。編譯器使用您的名稱空間來代替Office。 換句話說,我認爲你的名字與你的項目或你在其中的任何引用有衝突。

請檢查重疊名稱空間/類。