找不到命名空间 - 使用 TFS 构建 [英] Namespace could not be found - building using TFS

查看:38
本文介绍了找不到命名空间 - 使用 TFS 构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 TFS 时遇到问题.它不会构建我的项目,因为

I have trouble with TFS. It won't build my project because

找不到类型或命名空间名称Newtonsoft"(您是否缺少 using 指令或程序集引用?)

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

我尝试通过 nuget 添加它,但仍然出现此错误.当我通过 nuget 添加这个 dll 时,我还有其他项目可以正常工作.此外,该项目的本地构建成功.我在解决方案中创建了一个新文件夹,然后将 dll 放入其中并引用了它.

I tried adding it via nuget but still I am getting this error. I have other projects which work fine when i add this dll via nuget. Also, a local build of this project is successful. I created a new folder inside the solution and then placed the dll in it and I referenced it.

推荐答案

如果您的本地构建成功而只是 TFS 构建失败,那么通常是由于 dll 引用路径问题.确保 Dll 被引用为项目文件 (.csproj) 中的相对路径.

If your local build is successful and just the TFS build is failing then it is usually due to dll reference path issue. Make sure that the Dll is referenced as a relative path in the project file (.csproj).

要在单独的目录中添加相对引用,例如 C: fs_getSourcesassemblyabc.dll,请执行以下操作:

To add a relative reference in a separate directory, such as C: fs_getSourcesassemblyabc.dll, do the following:

通过右键单击解决方案资源管理器中的项目并选择添加引用,在 Visual Studio 中添加引用.

Add the reference in Visual Studio by right clicking the project in Solution Explorer and selecting Add Reference.

找到此引用所在的 *.csproj 并在文本编辑器中打开它.假设您的 .csproj 位置是 c: fs_getsourcesmyfoldermyprojectmyproj.csproj

Find the *.csproj where this reference exist and open it in a text editor. Lets say your .csproj location is c: fs_getsourcesmyfoldermyprojectmyproj.csproj

编辑 <HintPath > 等于

Edit the < HintPath > to be equal to

....assemblyabc.dll

....assemblyabc.dll

假设源文件夹下的文件夹(程序集、myfolder)存在于 TFS 中,此构建将正常工作.

This build will work properly with the assumption that the folders ( assembly, myfolder) under the sources folder exist in TFS.

希望这会有所帮助.

这篇关于找不到命名空间 - 使用 TFS 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆