C# HRESULT 异常:0x80070057 (E_INVALIDARG)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14871449/
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
Exception from HRESULT: 0x80070057 (E_INVALIDARG)
提问by Simsons
I have a WPF application . While building it I am getting the following error:
我有一个 WPF 应用程序。在构建它时,我收到以下错误:
Could not load file or assembly or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
无法加载文件或程序集或其依赖项之一。参数不正确。(来自 HRESULT 的异常:0x80070057 (E_INVALIDARG))
Application is trying to load the assembly from virtual drive (as debug Folder)
应用程序正在尝试从虚拟驱动器加载程序集(作为调试文件夹)
Ex: [subst r: c:[my Assembly bin pth]
例如:[subst r: c:[my Assembly bin pth]
Earlier I was mounting c:\bin as a netwwork drive and was getting te following error.
早些时候,我将 c:\bin 安装为网络驱动器,但出现以下错误。
This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545for more information.
该程序集可能是从 Web 下载的。如果程序集是从 Web 下载的,Windows 会将其标记为 Web 文件,即使它驻留在本地计算机上。这可能会阻止它在您的项目中使用。您可以通过更改文件属性来更改此名称。仅取消阻止您信任的程序集。有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=179545。
Edit: I am not able to find the Unblock button in properties window by the way.
编辑:顺便说一下,我在属性窗口中找不到取消阻止按钮。
回答by adityaswami89
For the Error which you were getting when you were mounting is due to blocking for Assemblies/DLL. Right click on what ever DLL's you have downloaded and you will get an option to unblock it .
对于您在安装时遇到的错误是由于程序集/DLL 的阻塞。右键单击您下载的任何 DLL,您将获得一个选项来取消阻止它。
For the Could not load file or assembly or one of its dependencies error, put a breakpoint in the constructor of the starting class and check it is failing due to what.
对于无法加载文件或程序集或其依赖项之一的错误,在起始类的构造函数中放置一个断点并检查它由于什么原因而失败。
回答by Anupam Roy
Clear out the temporary framework files for your project in:
清除项目中的临时框架文件:
For Windows 7, the path is:
对于 Windows 7,路径为:
C:\Users\[username]\AppData\Local\Temp\Temporary ASP.NET Files\
For 64 bit systems with 'Framework' in the path the full path is:
对于路径中带有“Framework”的 64 位系统,完整路径为:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\
回答by JGilmartin
this happened to me when i got a blue screen while building.
当我在构建时出现蓝屏时,这发生在我身上。
i had to delete my packages and bin folders, and get then from TFS
我不得不删除我的包和 bin 文件夹,然后从 TFS 获取
at that time i had nothing in the following location...
当时我在以下位置什么都没有...
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
to resolve i set Visual Studio in debug mode and then monitored the above directory. i deleted the files as they appeared and then the app started working again.
为了解决我将 Visual Studio 设置为调试模式,然后监视上述目录。我删除了出现的文件,然后应用程序又开始工作了。
time to start looking for a new Dev machine.
是时候开始寻找新的开发机器了。
回答by agit
I was encountering this problem after a windows 8 blue screen error while building my wcf service. I tried all suggestions above.. but it didn't solve the problem.
在构建 wcf 服务时出现 Windows 8 蓝屏错误后,我遇到了这个问题。我尝试了上面的所有建议......但它没有解决问题。
Lastly, I removed and recreated the new application from IISon the same wcf project.
Then every thing works fine.
最后,我在同一个 wcf 项目上从 IIS 中删除并重新创建了新应用程序。
然后一切正常。
回答by Ryan Boken
Removing all temp files from the path below still works, it saved my development site hosted on a web server from (HRESULT: 0x80070057 (E_INVALIDARG))
从下面的路径中删除所有临时文件仍然有效,它保存了我在 Web 服务器上托管的开发站点 (HRESULT: 0x80070057 (E_INVALIDARG))
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\
回答by alexlomba87
Quoting thisSO answer:
引用这个SO 答案:
This can happen while referencing COM wrapper dlls.
引用 COM 包装器 dll 时可能会发生这种情况。
Go in your Visual Studio Project, under References, select the referenced COM wrapper assemblies, right click, preferences, and make sure that Embed Interop Types
and Specific Version
are both set to False
.
进入你的 Visual Studio 项目,在引用下,选择引用的 COM 包装程序集,右键单击,首选项,并确保Embed Interop Types
和Specific Version
都设置为False
.
回答by Ernest
On Visual Studio 2019 I was able to fix this manually deleting the ".vs"folder into the solution directory.
在 Visual Studio 2019 上,我能够修复此问题,将“.vs”文件夹手动删除到解决方案目录中。
Thanks
谢谢