Exception from HRESULT: 0x80070057 (E_INVALIDARG)

38

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.

c#
wpf
.net-assembly
asked on Stack Overflow Feb 14, 2013 by Simsons • edited Feb 14, 2013 by Bo Persson

7 Answers

95

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

answered on Stack Overflow Jun 11, 2013 by Anupam Roy • edited Apr 25, 2015 by shA.t
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\

answered on Stack Overflow Jan 8, 2016 by Ryan Boken
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.

answered on Stack Overflow Oct 3, 2015 by JGilmartin
2

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

Thanks

answered on Stack Overflow Dec 2, 2019 by Ernest
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.

answered on Stack Overflow Feb 14, 2013 by adityaswami89
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.

answered on Stack Overflow Nov 4, 2015 by agit • edited Nov 4, 2015 by T3 H40
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.

answered on Stack Overflow Mar 21, 2019 by alexlomba87

User contributions licensed under CC BY-SA 3.0