I keep getting this error:
System.IO.FileNotFoundException: System.IO.FileNotFoundException: Could not load file or assembly 'Moq, Version=4.2.1507.118, Culture=neutral, PublicKeyToken=69f491c39445e920' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
It compiles fine in my project, and all of my Moq Nuget packages are set to version 4.2.1507.118. I don't have any binding redirects for Moq.
By the way, is there any way to turn assembly binding logging on for a VSTS hosted agent?
Log files:
Here's my build step log output
Here's my test step log output
Related
Using Windows it is possible to enable Fusion assembly logs via registry (https://techcommunity.microsoft.com/t5/iis-support-blog/fusion-log-viewer-fuslogvw-exe/ba-p/784396) to be saved on local hard drive.
My .NET Core 3.1 application is working properly on Windows. On Docker container based on Linux I'm getting randomly "Could not load file or assembly" for some assemblies, which actually are available in proper place in build directory and for some runs they work properly.
Sample assembly error:
Could not load file or assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106'. The system cannot find the file specified.
I would like to enable debug logging related to assemblies to find a root cause of described issue.
Can I enable anyhow fusion logs on Linux?
Written unit test cases using MS Test Framework for our project which is on C# and using Fakes to bypass the DB call. Test cases are running fine in Visual Studio 2015.
But when try to run through Jenkins Job it’s giving below error message:
Error Message:
Test method threw exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Could anyone please guide to fix the above error.
The root cause of the issue - Microsoft.QualityTools.Testing.Fakes version 11.0.0.0 was missing in bin/debug in Git repository. Additionally all dll's which are referred for unit test project needs to manually added under bin/debug folder in the Git
My different roles run fine on my local machine. They run well enough when I deploy my project to Azure manually.
However, when I deploy them via VSTS CI/CD tools, the various apps roles refuse to start with "Could not load file or assembly" errors. I'm using Simple Injector.
Some of my projects say they can't find a DLL of another project in the solution:
Unhandled Exception: Could not load file or assembly 'DeviceCloud.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at DeviceCloud.Application.CacheWorker.SimpleInjectionInitializer.RegisterPerWebRequestObjects() ...
Others complain more indirectly. I'm including yet another project, MasterNLogger, that depends on the ILogger interface, so I think what's really going on is it can't locate my MasterNLogger DLL:
Unhandled Exception: The configuration is invalid. Creating the instance for type ILogger failed. The registered delegate for type ILogger threw an exception. The registered delegate for type ILoggingAdministration threw an exception. Could not load file or assembly 'NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c' or one of its dependencies. The system cannot find the file specified. at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()...
Why is this working when I deploy manually, and not when I'm deploying with the VSTS tools and build agent?
You need to add task(s) before build task to restore the packages:
Add NuGet Tool Installer task to build definition (Version of NuGet.exe to install: 4.4.1)
Add NuGet restore task (Path to solution, packages.config, or project.json: **\*.sln)
I've created a webjob with a simple C# Console application. I make use of the Azure blobs and a database connection - locally everything works like a charm.
In Azure portal I've made a simple app where I added my exe and force it to run. From the logs i get:
[10/09/2016 20:38:52 > ed5cb9: ERR ] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Don't mind the 6.0.0.0 version, I've tried 7.0.0.0 and the latest 7.2.1, the result does not differ.
Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
According to the error you provided, I recommend that you could try to make sure the specific assembly is deployed to Azure. You could use Kudu Console (Can be accessed from Azure : App Service > Web App> Development Tools > Advanced Tools)
and check your assembly in the following path:
d:\home\site\wwwroot\app_data\jobs\[triggered|continuous]\{job name}
Additionally, if you deploy your WebJob via the Azure Portal, you could directly upload a zip file that contains the WebJob's files. For more details about Web Jobs, you could follow this tutorial.
I added an existing project to my solution. When I run all unit tests with MSTest runner, I get the following error on a couple of tests:
Message: Test method soandso threw exception:
System.IO.FileLoadException: Could not load file or assembly 'log4net, Version 1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' or one of it's dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:0x80131040)
I know others have had the same problem and there is other questions and answers about this topic. But I tried many things, but nothing helped.
The version of log4net we use is 1.2.13.0.
I checked with FUSLOGVW.exe for binding errors. The log4net shows up with the added assembly and some Unknown assembly.
The reference of log4net in the assembly shows version 1.2.13.0 which was added with NuGet. So it is probably a dependent assembly that is causing all this trouble.
I tried changing log4net back to version 1.2.12.0, but I still get the same error message.
When I run all the tests with MSTest testrunner, these errors show up. When I only run the failed tests, they pass. When I run them individually, they also pass.
I tried binding redirection, but I did it for the assembly that is tested not the testing assembly. I did not know how to do that for a test assembly - there is no config.
When I run the tests with Resharper test runner they also pass (but other tests fail). The TFS Build server runs the MSTest-runner, therefore I need to get it working with MSTest.
Does anyone know how I can get this resolved?
The culprit was found. Like I was suspecting, a dependent assembly was referencing log4net 1.2.12.0. The tool used to find out was dotPeek. Luckily we do have the source code for the dependent assembly and we can change it to reference the latest log4net. This solves this issue.
So if anyone has a similar problem, use dotPeek or a similar tool to go through the dependent assemblies to find out what versions of assemblies it is referencing.