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
  • 18,664
  • 18
  • 94
  • 132
Ofek Agmon
  • 4,760
  • 13
  • 51
  • 97

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
  • 27,871
  • 5
  • 44
  • 49
  • 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
  • 369
  • 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
  • 580
  • 8
  • 22