C# .dll 文件无法访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12582484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.dll file not accessible
提问by Ofek Agmon
I am trying to add a dll to my project. When I do "add reference" and try to add it, it tells me :
我正在尝试向我的项目添加一个 dll。当我执行“添加引用”并尝试添加它时,它告诉我:
"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".
“无法添加对...的引用。请确保该文件可访问,并且它是有效的程序集或 COM 组件”。
BTW, I am trying to add g729.dll
顺便说一句,我正在尝试添加 g729.dll
How can I add the dll?
如何添加dll?
回答by Aghilas Yakoub
You must registeryour dll in register base before add reference
你必须register在注册基地之前你的dlladd reference
You can use Regsvr32 tool
您可以使用 Regsvr32 tool
Link : http://msdn.microsoft.com/en-us/library/ms859484.aspx
回答by aa aa
Register your dll by providing the proper path s below:-
通过提供以下正确路径来注册您的 dll:-
Open the command prompt of your visual studio and register your dll
打开你的visual studio的命令提示符并注册你的dll
c:\Windows\System 32> regsvr32 yourdll.dll
c:\Windows\System 32> regsvr32 yourdll.dll
回答by Can PERK
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
如果您知道程序集名称和版本如下,您可以卸载项目并在编辑模式下打开 csproj。然后找到引用并添加你的dll引用
Example
例子
<Reference Include="ReferenceDllAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5a159fbc978150a3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\TempPath\ReferenceDllAssemblyName.dll</HintPath>
</Reference>

