Exception from HRESULT: 0x80070057 (E_INVALIDARG)
Asked Answered
W

9

41

I have a WPF application . While building it I am getting the following error:

Could not load file or assembly or one of its dependencies. The parameter is incorrect. (Exception from 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]

Earlier I was mounting c:\bin as a netwwork drive and was getting te following error.

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=179545 for more information.

Edit: I am not able to find the Unblock button in properties window by the way.

Wellesz answered 14/2, 2013 at 9:21 Comment(2)
This answer from a related post is very helpful.Price
Hi @Simsons, none of the following answers has been accepted, and I'm wondering if the root cause has anything to do with the virtual drive created by the subst command, as I am experiencing exactly the same as yours, of my project resides in the virtual drive.Patisserie
C
100

Clear out the temporary framework files for your project in:

For Windows 7, the path is:

C:\Users\[username]\AppData\Local\Temp\Temporary ASP.NET Files\

For 64 bit systems with 'Framework' in the path the full path is:

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\

http://www.solutioncottage.com/ShowSolution.aspx?solID=59

Cadelle answered 11/6, 2013 at 9:37 Comment(7)
Thanks for your answer , this should be the correct one.Thanks , you saved my time.Working
This should be marked as an answer @Wellesz how about you mark it?Feretory
This is very useful information (it certainly solved my problem) but I don't think it is the correct answer as it refers to ASP .NET, whereas the question is about WPF.Clearheaded
I had other issues also, but this was one of them :)Misdemeanant
Suddenly got this error after recovering from a BSOD on my Win10 machine. This fixed it for me. ThanksSomeone
Restarting visual studio did it for me.Landgrabber
I restarted visual studio too, and made sure to rebuild also. It then worked. Restarting alone didn't work for me.Slipcover
S
10

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))

C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\

Sefton answered 8/1, 2016 at 18:45 Comment(0)
T
7

On Visual Studio 2019 I was able to fix this manually deleting the ".vs" folder into the solution directory.

Thanks

Terpene answered 2/12, 2019 at 16:30 Comment(2)
Worked for Visual Studio 2017 too. Thanks!Ramify
This solution worked for Visual Studio 2022 too.Straggle
K
4

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

at that time i had nothing in the following location...

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.

time to start looking for a new Dev machine.

Kaykaya answered 3/10, 2015 at 10:57 Comment(0)
H
1

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 .

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.

Heterochromous answered 14/2, 2013 at 11:16 Comment(1)
Mentioned on question is that there are no Unblock OptionWellesz
S
1

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.

Lastly, I removed and recreated the new application from IIS on the same wcf project.
Then every thing works fine.

Selimah answered 4/11, 2015 at 6:26 Comment(0)
S
0

Quoting this SO answer:

This can happen while referencing COM wrapper dlls.

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.

Sprinkling answered 21/3, 2019 at 14:50 Comment(0)
B
0

@Ernest 's answer worked for me on Visual Studio 2022

On Visual Studio 2019 I was able to fix this manually deleting the ".vs" folder into the solution directory.

Befriend answered 28/9, 2022 at 9:2 Comment(0)
C
0

In my case, this issue was caused by the path length limit in Windows 10. I didn't find any temporary files to delete anywhere. This issue was resolved for me only when i moved my project to a directory with a shorter path length. I'm using Microsoft Visual Studio 2022.

Charger answered 17/4, 2023 at 9:15 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.