Could not load file or assembly in VS2017 with IIS express - visual-studio

We have a ASP.NET project in the company that runs for 5/6 developers. All Visual Studio 2017 and debug on IIS Express, no crazy setting or anything to make it run.
1 colleague cannot get it to work, he always gets the following exception:
We had this problem a few months back, then out of frustration the PC was re-installed and the problem was gone. He didn't develop for a few weeks and today the problem appeared again.
I searched long and far but it's such a generic error I can't really figure this one out.
When I run the fusion log viewer I see the following result:
https://pastebin.com/aCVZn3EB
The operation failed.
Bind result: hr = 0x80131018. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Program Files\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/User/Projects/project/project.UserSite/
LOG: Initial PrivatePath = C:\Users\User\Projects\project\project.UserSite\bin
LOG: Dynamic Base = C:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\vs\e0254dae
LOG: Cache Base = C:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\vs\e0254dae
LOG: AppName = 38c6ff11
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\User\Projects\project\project.UserSite\web.config
LOG: Using host configuration file: C:\Users\User\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll.
LOG: Assembly is loaded in default load context.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80131018).
*** Assembly Binder Log Entry (7/18/2017 # 8:55:15 AM) ***

Are you trying to load a .NET 4 assembly with an EXE that asked for a diferrent CLR version? That requires an app.exe.config file that forces CLR 4 to be used.
Also please check the he has the same version of .NET installed.

1- Close Visual Studio
2- Delete all files from "C:\WINDOWS\Microsoft.NET\Framework......\Temporary ASP.NET"
3- Open VS
4- Rebuild then run

I have the same issue, its random. Just install missing package via Nuget for that project. Open Package Manager Console and type:
PM> Install-Package System.ServiceModel.Activities
and go on installing packages till there is no more error: then stop.

Turns out with the help of Fusion Log I found 1 file that was 0kb in size: C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll
I restored the file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.ServiceModel.Activities.dll and it worked again!

Related

System.IO.IOException during the build process in VisualStudio 2017

I'm working on a Hololens application using Unity 2018.2.20f1. I'm building the application for UWP from Unity without a problem. However, after opening up the generated solution in the VisualStudio 2017 (Community Edition) and trying to build it, the build process fails with the following errors:
Severity Code Description Project File Line Suppression State
Error MSB3073 The command ""D:\Projects\VSProjects\VirtualPrague\Il2CppOutputProject\\IL2CPP\build\il2cpp.exe" --libil2cpp-static --compile-cpp -architecture=x86 -configuration=Release -platform=winrt -outputpath="D:\Projects\VSProjects\VirtualPrague\\build\bin\Win32\Release\GameAssembly.dll" --data-folder="D:\Projects\VSProjects\VirtualPrague\\build\bin\Win32\Release\\" -cachedirectory="D:\Projects\VSProjects\VirtualPrague\\build\obj\il2cppOutputProject\Win32\Release\\" -generatedcppdir="D:\Projects\VSProjects\VirtualPrague\Il2CppOutputProject\\Source" --additional-defines=WINDOWS_UWP --additional-defines=UNITY_UWP --additional-defines=UNITY_WSA_10_0 --additional-defines=UNITY_WSA --additional-defines=UNITY_WINRT --additional-defines=PLATFORM_WINRT -dotnetprofile=unityjit -verbose --map-file-parser="D:\Projects\VSProjects\VirtualPrague\Il2CppOutputProject\\IL2CPP\MapFileParser\MapFileParser.exe"" exited with code -532462766. Il2CppOutputProject C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 44
and
Severity Code Description Project File Line Suppression State
Error LNK1181 cannot open input file 'D:\Projects\VSProjects\VirtualPrague\build\bin\Win32\Release\GameAssembly.lib' VirtualPrague D:\Projects\VSProjects\VirtualPrague\VirtualPrague\LINK 1
In the output there are multiple exceptions, similar to this one:
1>il2cpp.exe didn't catch exception: System.IO.IOException: The process cannot access the file 'C:\Users\dev\AppData\Local\Temp\tmpDE97.tmp' because it is being used by another process.
1> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1> at System.IO.File.InternalDelete(String path, Boolean checkHost)
1> at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
1> at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
1> at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
1> at il2cpp.Program.DoRun(String[] args)
1> at il2cpp.Program.Run(String[] args)
1> at il2cpp.Program.Main(String[] args)
The exceptions are the same but were thrown for different files. I tried to reinstall the Visual Studio and managed to get a build. The next day I turned on the PC and this error was back. I stopped all of the VS instances and processed from the task manager, deleted all of the files from the Temp folder and managed to get a build a couple more times. Then this error came back.
From what I can tell, during the build process, Visual Studio creates some *.tmp files and for some reason thinks that another process is using it.
Any idea why this is happening and how can it be solved?
Thanks a lot!
Edit: So here is what I did so far (this is more of a work around rather then a solution)
Uninstall vs and unity
Clear the registry with ccleaner and Advanced Uninstaller Pro
Install vs and Unity
Every time I want to get a build I,
Close all of vs instances
Clear Temp folder (C:\Users\dev\AppData\Local\Temp)
Delete previous vs solution
Build from Unity
Run vs as Administrator
Build and deploy the solution from vs
And it works for the most the time. Also, changing the solution configuration (from debug to release and vice versa) helps sometimes.

Visual studio installer doesn't start correctly

I just had to change my HDD. So I installed a version of Windows 10 Education on my computer, and now I'm trying to install Visual studio 2017 community/enterprise ( tried both ). After running the installer which was downloaded from the official website it doesn't start the installation, I just see for a tiny amount of time a small window pop but then it instantly shuts. What could be the reason for this behavior and how to fix this problem?
Edit: I can install other software, I managed to install a few other programs without a problem, I notice this behavior only with Visual studio and additionally .NET Framework installer.
Edit2:
I found this in my temp folder :
[4/20/2017, 11:30:37] === Logging started: 2017/04/20 11:30:37 ===
[4/20/2017, 11:30:37] [4/20/2017, 11:30:38] --- logging level: standard ---
[4/20/2017, 11:30:38] Directory 'C:\Users\2D94~1\AppData\Local\Temp\931f7233a5c56697278d79b1\' has been selected for file extraction
[4/20/2017, 11:30:38] Extracting files to: C:\Users\2D94~1\AppData\Local\Temp\931f7233a5c56697278d79b1\
[4/20/2017, 11:30:38] Error 0x8007002a: Failed to extract all files out of box container #0.
[4/20/2017, 11:30:38] Error 0x8007002a: Failed to extract
[4/20/2017, 11:30:38] Error 0x8007013d: Failed to get error string from error: 0x8007002a
[4/20/2017, 11:30:38] The entire Box execution exiting with result code: 0x8007002a
[4/20/2017, 11:30:38] Launched extracted application exiting with result code: 0x0
[4/20/2017, 11:30:38] === Logging stopped: 2017/04/20 11:30:38 ===
Edit 3: THANKS MICROSOFT you really screwed me up huh.
Edit 4: After full Windows reinstall with the latest version still getting this error.
Edit 5: Changed windows version from education to professional and it works!
Had the same issue. I was running installer from my /Download folder.
Try move the installer to D: drive, it helped me.
Regards

How to overcome "Could not load type 'Microsoft.Cct.Services.Sqm.IWatSqmService'" without updating?

I'm getting the same error message as in this question: Could not load type 'Microsoft.Cct.Services.Sqm.IWatSqmService' Unfortunately, I cannot upgrade to Azure SDK 2.9, as the top answer there suggests.
Specifically, I get this error in a message box whenever I try to package my Azure Cloud Service project:
What's interesting is that I can start the same project in the emulator, which I would assume involves packaging it.
Things I've tried:
Ensuring that I only have version 2.8.2 of the emulator installed (I may have had 2.9 installed initially)
Reinstalling version 2.8.2 of the SDK
Manually copying the Windows Azure Tools from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0 to the v14.0 equivalent.
Ensuring that C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.8 exists
Reinstalling Visual Studio (so you know I'm desperate!)
And I've no idea what to try next. I can't work out which DLL is supposed to hold the Microsoft.VisualStudio.WindowsAzure.Services assembly, I can't find any references in any config files, and all the Google hits seem to point back to the SO question linked above.
What's going on? And how can I fix it?
In case I'm being an idiot, here's all the Azure-related things I've got installed:
Also (just in case it's relevant) I'm on Windows 7 SP1.
Update 17/01/16
Following some advice from the excellent Rest Azured Slack channel, I've tried using ProcMon and Fusion Log to diagnose this (spoiler: without success)
ProcMon filtered to that assembly returns nothing:
Fusion log (set to log everything) yields lots of entries like this:
* Assembly Binder Log Entry (17/01/2017 # 11:52:02) *
The operation was successful. Bind result: hr = 0x0. The operation
completed successfully.
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
executable C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\devenv.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: DisplayName = Microsoft.VisualStudio.WindowsAzure.Services, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio
14.0/Common7/IDE/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = devenv.exe Calling assembly
: Microsoft.VisualStudio.WindowsAzure, Version=2.9.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
=== WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with
Assembly.Load(). WRN: No matching native image found. LOG: IL assembly
loaded from C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\Microsoft.VisualStudio.WindowsAzure.Services.dll.
When I explore the DLL mentioned, I can find Microsoft.Cct.Services.Sqm, but it doesn't contain a type IWatSqlService:
This feels like it's the crux of the issue, but I've no idea what to do next. Presumably I'd need to replace the DLL with a version that does define IWatSqlService, but I'm not sure where I'd get one. Or, for that matter, why it would even be necessary.
Next stop is probably a full wipe of the machine.
I've had the same problem, and solved it by not using the Web Platform Installer.
Download all parts (Microsoft Azure SDK for .NET - 2.8.2) from the Microsoft site: https://www.microsoft.com/en-us/download/details.aspx?id=50041 and follow the instructions how to install them.
For anyone else with this problem. I ended up resolving this by nuking it from orbit. Fresh install of Windows, reinstall VS and the SDK.
Confusingly, you can also see this error when you add a new
<setting name="TODO" />
element to your *.csdef file but either:
forget to add the corresponding <setting name="TODO" value="TODO" /> element to every *.cscfg file, or
accidentally add a duplicate <setting name="TODO" value="TODO" /> element to any of the *.cscfg files.

.net: How to clean up corrupted assembly being referenced?

I shut down computer without closing running programs. Now when I run my application on localhost, I'm getting the following error:
Could not load file or assembly 'FluentValidation' or one of its dependencies.
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
I've find this article, which explains that I need to cleanup the temporary folder.
I'd like to know what the meaning of cleanup in this case: Just select files in the folder and delete them? I don't want to mess up with my computer.
Thanks for helping.
EDIT
=== Pre-bind state information ===
LOG: DisplayName = FluentValidation
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: FluentValidation | Domain ID: 3
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for
more information
and common solutions to this issue.
LOG: Appbase = file:///C:/_/trunk/xCIv3.1.0/
LOG: Initial PrivatePath = C:\_\trunk\xCIv3.1.0\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\_\trunk\xCIv3.1.0\web.config
LOG: Using host configuration file:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial,
or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET
Files/root/ce84b183/bda9c1be/FluentValidation.DLL.
LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET
Files/root/ce84b183/bda9c1be/FluentValidation/FluentValidation.DLL.
LOG: Attempting download of new URL
file:///C:/_/trunk/xCIv3.1.0/bin/FluentValidation.DLL.
LOG: Using application configuration file: C:\_\trunk\xCIv3.1.0\web.config
LOG: Using host configuration file:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
ERR: Failed to complete setup of assembly (hr = 0x80070057). Probing terminated.

Error 1 Unable to copy file "obj\Debug\SourceProject.exe" to "bin\Debug

This is a super weird question for Visual Studio 2013: Windows Forms Application 3.5!
I designed and made the program, then I ran the program for the first time and an error pops up.
And then I click cancel, retry and this time I click yes and this pops up:
Error while trying to run project: Could not load file or assembly
'SourceProject' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference.(Exception
from HRESULT: 0x80131040)
Any ideas on fixing it?
FULL ERROR LOG
Error 1 Unable to copy file "obj\Debug\SOURCEPROJECT.exe" to
"bin\Debug\SOURCEPROJECT.exe". Access to the path
'obj\Debug\SOURCEPROJECT.exe' is denied. SOURCEPROJECT
Just open your Debug Configuration near by Application Run Button in VS. Then , Choose debug with Any CPU to x64 or x86 .. May be it will help someone.
Thanks,

Resources