1
votes
<ItemGroup>
  <Reference Include="Facebook">
     <HintPath>E:\MSBuild\library\Facebook.dll</HintPath>
</Reference>
 <Reference Include="Hammock.WindowsPhone">
     <HintPath>E:\MSBuild\library\Hammock.WindowsPhone.dll</HintPath>
</Reference>
</ItemGroup>

I have tried adding external .dll files with the above script but getting the error like:

error CS0246: The type or namespace name 'Hammock' could not be found (are you missing a using directive or an assembly referen ce?) [E:\MSBuild\src\MobiReader.csproj]

any one please help ..

1
Sounds more like you're missing a using directive than the assembly reference.David Pfeffer
In the Visual Studio Solution Explorer -> References Tab see if there is an exclamation icon on top of Hammock.WindowsPhone.dll.Soundararajan
In the Visual Studio Solution Explorer -> References Tab see if there is an exclamation icon on top of Hammock.WindowsPhone.dll. If so either the path is wrong or the assembly cannot be resolved. Also it depends on the Target framework of the referenced dll and the project you are creating. Make sure both of them are same. (Am having this doubt since you seem to use some phone libraries :))Soundararajan

1 Answers

0
votes
  1. I would try to come up with a system so that your ThirdPartyReferences are not absolute-path references, but rather some kind of relative path. Mine usually look like:

    ..\ThirdPartyReferencs\MyCoolDll.dll

My Structure usually looks like this

.\MySolution01.sln
.\MyCSProj01\MyCSProj01.csproj
.\MyCSProj02\MyCSProj02.csproj
.\MyCSProjN\MyCSProjN.csproj
.\ThirdPartyReferences\
.\ThirdPartyReferences\MyCoolDll.dll
.\ThirdPartyReferences\SomePDFLibrary.dll
  1. If that is not possible, you can manipulate the csproj (xml). Here is a close example (checked the accepted answer from this post):

How to add a linked file to a csproj file with MSBuild. (3.5 Framework)