Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 490
Sabareesh Kkanan Avatar asked Aug 14 '13 22:08

Sabareesh Kkanan


1 Answers

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.

like image 99
Isaiah4110 Avatar answered Sep 27 '22 16:09

Isaiah4110