2017-04-13 52 views
1

我有一個問題,很遺憾,我沒有找到可以修復的解決方案我的問題,其他解決方案可以找到,但沒有人爲我工作TFS - 錯誤:「名稱空間'blublu'中不存在類型或名稱空間名稱'blabla'(您是否缺少程序集引用?)

當我在本地構建我的解決方案,都是完美的,但是當我用這個解決方案啓動構建定義時,我有一些問題 首先幾個erros如:

Console.cs (5): The type or namespace name 'Core' does not exist in the namespace 'Toto' (are you missing an assembly reference?) 
Enti\Extensions.cs (602): The type or namespace name 'Attribute' could not be found (are you missing a using directive or an assembly reference?) 

和其他具有相同的錯誤作爲最後一個

爲了幫助我,我有這些警告,以及,在下文中,其中之一(其它類似):

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1605): Could not resolve this reference. Could not locate the assembly "Comarch.B2.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 

我試了一下:

  1. 的引用,如「核心」來說是井投入 項目參考文獻;
  2. 刪除,並添加警告引用
  3. 經過版本框架DOTNET路徑lenghts (http://www.gitshah.com/2011/06/visual-studio-2010-fixing-referenced.html

例如第一個錯誤上面:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using .Core.Interfaces.Dictionaries; 

namespace Toto.Presentation.Extensions.Interfaces 
{ 
    public class Console 
    { 
     ... 
    } 
} 

然後我的日誌的廢料:

> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): 
> warning MSB3245: Could not resolve this reference. Could not locate 
> the assembly "Common". Check to make sure the assembly exists on disk. 
> If this reference is required by your code, you may get compilation 
> errors. 
> [c:\bw\41\src\F\TFS\te\Pro\Extensions\Toto.Presentation.Extensions.Interfaces\Toto.Presentation.Extensions.Interfaces.csproj] 
>    For SearchPath "{HintPathFromItem}". 
>    Considered "..\..\..\..\..\..\..\..\..\..\Toto.Common.dll", but it didn't exist. 
>    For SearchPath "{TargetFrameworkDirectory}". 
>    Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Toto.Common.winmd", 
> but it didn't exist. 
>    Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Toto.Common.dll", 
> but it didn't exist. 
>    Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Toto.Common.exe", 
> but it didn't exist. 

謝謝v對於幫助我很重要,我在2天前偷偷摸摸地走了過去。

+0

您是否在「核心」程序集中檢入TFS,並在構建時將其下載到構建代理服務器? –

回答

2

要解決此錯誤,您需要確保此程序集將存在於構建代理的正確路徑中。

在項目的.csproj文件中,它定義了您引用的項目以及它所在的位置。

<Reference Include="xxx"> 
     <HintPath>..\..\xxx\xxx.dll</HintPath> 
</Reference> 

而在您的項目中,HintPath似乎是"..\..\..\..\..\..\..\..\..\..\Toto.Common.dll"。你可以檢查你的生成代理服務器,這是否會下載。如果沒有,請檢查您的構建定義的存儲庫映射

"..\"表示返回到最高級別。它有10 "..\",因此需要從.csproj文件所在的位置返回到10個級別。

我建議你重新定位你的Toto.Common.dll。您可以將您的項目/解決方案和引用的dll放在一個文件夾中,並在您的項目中再次引用。然後在存儲庫映射中映射此文件夾。另一個條件是你想在另一個項目構建完成後得到這個DLL。您需要映射兩個項目並在您的定義中構建它們。

+0

太棒了!完美,謝謝! – FrankVDB

1

Castle.Core參考,是從溫莎城堡,你可能通過Nuget獲得?然後你的構建可能需要在編譯之前做一個「nuget恢復」。

您是否試過將源代碼控制中的代碼檢出到一個空文件夾中並在那裏編譯它?

+0

是的我在編譯之前啓用了nuget還原,我少了一個警告。但其他警告我編輯了我的第一條消息。我也檢查了代碼。 – FrankVDB

+0

此Nuget恢復適用於VS2017嗎? – DanielV

+0

我在建築之前總會有一個nuget恢復。在VS2017中,它可能會默認啓用,因此您不必手動執行此操作。 – RasmusW

相關問題