9

I am trying to add a dll to my project. When I do "add reference" and try to add it, it tells me :

"A reference to ... could not be added. please make sure that the file in accessible, and that it is a valid assembly or COM component".

BTW, I am trying to add g729.dll

How can I add the dll?

Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
Ofek Agmon
  • 5,040
  • 14
  • 57
  • 101

3 Answers3

7

You must register your dll in register base before add reference

You can use Regsvr32 tool

Link : http://msdn.microsoft.com/en-us/library/ms859484.aspx

Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51
  • In my case I changed the dll installation folder and lost references at visual studio. Got the file back where it was before and things works again. Thanks for your help @AghilasYakoub – Eduardo Xavier Nov 07 '14 at 14:25
  • 1
    Aghilas, fyi - the link you provided no longer works! – Dan Beaulieu Apr 10 '18 at 10:43
3

Register your dll by providing the proper path s below:-

Open the command prompt of your visual studio and register your dll

c:\Windows\System 32> regsvr32 yourdll.dll

aa aa
  • 399
  • 3
  • 6
0

If you know assembly name and version like below you can un load project and open csproj in edit mode. Then find references and add you dll reference

Example

    <Reference Include="ReferenceDllAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5a159fbc978150a3, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\TempPath\ReferenceDllAssemblyName.dll</HintPath>
    </Reference>
Can PERK
  • 590
  • 8
  • 24