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

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.

Related

Could not load file or assembly in VS2017 with IIS express

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!

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.

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,

SidebySideConfiguration error while launching an EXE

I'm encountering Side-by-Side configuration error when launching an EXE with arguments in CommandPrompt. This EXE is a third party EXE and it's ensured to be a working one.
But it does not work in my system - Am I missing anything? I used sxstrace in the eventlog to view the details - below is what I got. I'm not able to interpret.
I've VS 2012 installed in my machine already - also VC++2012/2010/2008 redistributable packages additionally.
================= Begin Activation Context Generation. Input Parameter: Flags = 0 ProcessorArchitecture = x86 CultureFallBacks =
en-US;en ManifestPath = C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\Installer.exe
AssemblyDirectory = C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\ Application Config
File =
----------------- INFO: Parsing Manifest File C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\Installer.exe. INFO:
Manifest Definition Identity is (null). INFO: Reference:
Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Reference:
Microsoft.VC90.DebugMFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference
Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
INFO: Resolving reference for ProcessorArchitecture x86. INFO:
Resolving reference for culture Neutral. INFO: Applying Binding
Policy.
INFO: No publisher policy found.
INFO: No binding policy redirect found. INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Attempt to probe manifest at C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\Users\20121011_PR2_1\Desktop\HotPlugUnplug
Stress\SourceCode\Soft_BIOS\bin\DvmuInstaller\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Did not find manifest for culture Neutral. INFO: End assembly probing. ERROR: Cannot resolve reference
Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed. End Activation Context
Generation.
The executable is looking for the Debug version of the VC 9.0 Common Run Time (Microsoft.VC90.DebugCRT). This library is not a part of the redistributable package for the Common Runtime. I forget why Microsoft has this stipulation. Maybe it's a security or a legal issue.
You have three options:
Ask the person who gave you the executable to rebuild the executable in release mode so that the executable links against the release version of the CRT. That's the version you have installed from the redistributable package.
Ask the person who gave you the executable to send the DebugCRT versions of the CRT. Look in the Visual Studio install location for the VC folder. Then look for redist\Debug_NonRedist\x86.
Install Visual Studio/Visual Studio express with C++. This will install the debug version of the CRT on your machine.

Microsoft VC Runtime Requirement and SXS error for Setup Custom Action in Vista

I created a setup project with VS2005 for an application that I'm developing, which installs fine on Windows 2000 and XP, but when I try to run the installer on Vista, it gives the following error:
There is a problem with this Windows
Installer package. A program required
for this install to complete could not
be run.
This error occurs at the very end of the install process, after it has already copied all of the files over to the disk, and it's occurring when it tries to run my custom actions executable.
The custom actions binary is a file called InstallCustom.exe, and is written in C++. It is very basic, and just handles the Install, Commit, Uninstall, and Rollback actions and does nothing more than set some registry entries and fire off a couple batch scripts to finalize the install.
I ran SXSTrace during the install to see what it was failing on and got the following trace:
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = x86
CultureFallBacks = en-US;en
ManifestPath = C:\Program Files\MyApp\InstallCustom.exe
AssemblyDirectory = C:\Program Files\MyApp\
Application Config File =
-----------------
INFO: Parsing Manifest File C:\Program Files\MyApp\InstallCustom.exe.
INFO: Manifest Definition Identity is (null).
INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
INFO: Resolving reference for ProcessorArchitecture x86.
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_516c10c30f4aae68.manifest
INFO: No binding policy redirect found.
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC80.CRT\8.0.50727.4053__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.DLL.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.MANIFEST.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
ERROR: Activation Context generation failed.
End Activation Context Generation.
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = x86
CultureFallBacks = en-US;en
ManifestPath = C:\Program Files\MyApp\InstallCustom.exe
AssemblyDirectory = C:\Program Files\MyApp\
Application Config File =
-----------------
INFO: Parsing Manifest File C:\Program Files\MyApp\InstallCustom.exe.
INFO: Manifest Definition Identity is (null).
INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
INFO: Resolving reference for ProcessorArchitecture x86.
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_516c10c30f4aae68.manifest
INFO: No binding policy redirect found.
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC80.CRT\8.0.50727.4053__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.DLL.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.MANIFEST.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
ERROR: Activation Context generation failed.
End Activation Context Generation.
As you can see, it is failing to find Microsoft.VC80.CRT, the Visual C++ runtime dll.
The weird thing is that this runtime is already included in the installer, by adding the merge modules: "Microsoft_VC80_CRT_x86.msm" and "policy_8_0_microsoft_vc80_crt_x86.msm"
However, I suspect that these merge modules don't actually get applied until after this error is occurring...
But I have not been able to figure out how to include these needed files before the InstallCustom.exe runs. I've even tried copying the runtime over to the directory that file is in before the install.
Is there anyway to fix this issue? And why would this not be an issue on XP and 2000, but on Vista...I would think it should have this runtime.
You should use static version of the CRuntime (if possible), it is best practice that custom action will have as little as possible prerequisites. It will make the custom action a little bit bigger (in 10th of KB range) but it's worth it.
To compile using the static CRuntime library goto Project Properties\C/C++\Code Generation\Runtime Library.
Don't forget that if your exe needs other dll that require that version of CRuntime they also need to compile use the static version.

Resources