Namespace could not be found - building using TFS [closed]

怎甘沉沦 提交于 2019-12-19 06:01:09

问题


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

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

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.


回答1:


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).

To add a relative reference in a separate directory, such as C:\tfs_get\Sources\assembly\abc.dll, do the following:

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

Find the *.csproj where this reference exist and open it in a text editor. Lets say your .csproj location is c:\tfs_get\sources\myfolder\myproject\myproj.csproj

Edit the < HintPath > to be equal to

..\..\assembly\abc.dll

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

Hope this helps.



来源:https://stackoverflow.com/questions/18243606/namespace-could-not-be-found-building-using-tfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!