2017-04-13 30 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

相关问题