Affectiva mscorlib.dll and dependencies error - c#

I'm building a C# Affectiva product, up until a few days ago everything was working fine. I did a clean install of Windows 10 and I am using Visual Studio Enterprise. I keep having the following error stating missing mscorlib.dll or affect.dll
Affectiva Error
I've tried referencing the dll, recopying the proper dll for debug mode, ensured .net Framework 4.0 is loaded and the VS C++ Redist 2013. I've ensured all updates are complete on my PC. I'm the only one in the group that can't run the program now. I don't know what else to do.
Any suggestions would be greatly appreciated.

Found a program named Dependency Walker. Ran it, and the files it says I was missing was from the Windows 8.1 API set. I install those and it works now.

I think you are missing affdex-native.dll in your build directory. You might have that in place the previous time, but since you updated Windows and did a clean build the dll went missing from your build directory.Here is the place where it is added in the csproj file for AffdexMe.

Related

Cannot find assembly Mono.Android when attempting to archive a Xamarin app for publishing

I had to do some work on a Xamarin project I didn't create that is currently in production. I can build the app in Debug and Release on both Android and iPhone, as can anyone else who clones the repo. However, no one on my team has been able to successfully archive the app for publishing. Everyone gets the same error: Could not resolve this reference. Could not locate the assembly "Mono.Android". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Question 1: Where exactly should Mono.Android exist on disk?
Could not locate the assembly "Mono.Android". Check to make sure the assembly exists on disk
In the projects .Droid folder in the references folder Mono.Android does exist but apparently this isn't enough. Where else should it exist if this is not the only place?
On Windows people say to look in something like C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid{VERSION NUMBER}\Mono.Android.dll but I am on Mac, so where might this be instead?
Question 2: Why exactly am I getting this error in the first place?
Whatever the problem is I don't understand why it would trigger when trying to archive only the .IOS project. As far as I know this shouldn't have anything to do with Mono.Android. I feel like I should only be getting this error when I try to archive the .Droid project.
Question 3: What solutions are there to this?
Requires minimum Android version: 6 (API level 23)
Target Android version: 9.0 (API level 28)
Everyone on the team is using VS for Mac.
I have confirmed that I have Android 9 Pie installed and with all it's packages. I have attempted to archive for publishing on both Visual Studio for Mac 2019 and 2022 but got the same result for each. I have had others on the team attempt the same.
I have attempted to re-reference Mono.Android but when I try to add a reference and I scroll down to Mono.Android the version is 0.0.0.0. Why would that be?
What am I missing and how do I get it?
If you need any additional information please ask and I'll do my best to share.
I finally successfully deployed the app. I found a hardcoded path to Mono.Android in the Droid project csproj file. I removed this and the Mono.Android error stopped, but I was still getting similar errors so this is what happened:
I believe that the app was originally developed in VS for Mac 2017 and used whatever Xamarin package versions came with whatever version of VS for Mac 2017 the app was developed in. I am using an M1 Mac and cannot install VS for Mac 2017 or a lot of the packages that I needed. So what I did was moved to VS for Mac 2022 and upgraded all Xamarin packages and then fixed the errors that arose from that.
Once all packages were upgraded the app still would not deploy properly so I downloaded Transporter and used that to deploy the app which was very easy.
I hope this helps someone in the future.

CefSharp - Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies

I've been working on a CefSharp WinForms app for a few weeks and I've had no issues with it. This morning, while adding a few things to the application, I tried to run it to test something and got the below error:
System.IO.FileNotFoundException was unhandled Message: An unhandled
exception of type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll Additional information: Could not load file or assembly
'CefSharp.Core.dll' or one of its dependencies. The specified module
could not be found.
After searching for a while I found this:
https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#Runtime_dependencies
I checked bin/Debug/x86 for the project and all of the dependencies appear to be present. More importantly, it had been working fine five minutes earlier, and I didn't touch anything beyond a single class for an Entity Framework migration.
I've tried cleaning and rebuilding the solution, restarting Visual Studio, restarting my PC, and clearing out /bin/Debug, and none of these have helped.
Why would this error appear now after several days without it, and how can I resolve the issue?
Edit: I've done some further experimenting and I'm able to get the application to run in Release mode but not Debug mode. If I change the output path of Release mode to Debug, it fails with the same error (likewise, it succeeds in Debug with the Release output path).
First, make sure you installed the Microsoft Visual C++ Redistributable:
Version v93 and above: use Microsoft Visual C++ 2019 Redistributable or greater
Version v65 - v92: use Microsoft Visual C++ 2015 Redistributable or greater
Older Versions: use Microsoft Visual C++ 2013 Redistributable (exact version)
You could download the Visual C++ Redistributable from Microsoft. See C++ binary compatibility between Visual Studio versions for more detail on the version compatability.
Make sure to match the correct architecture, if your application is x64, you need to install the x64 build of Visual C++ Redistributable. Likewise if your application is x86 then you need to install the x86 build of Visual C++ Redistributable.
The Microsoft Visual C++ Redistributable depends on the Universal CRT. The Universal CRT is included as part of Windows 10/11. On older versions of Windows the Visual C++ Redistributable will install the Universal CRT.
For those wishing to include the Visual C++ Runtime with their application it's technically possible to include the runtime with your application. See also Local Deployment section of the Deployment in Visual C++ article from Microsoft.
I had the same problem until I installed the following redistributable:
SuperBerry's solution of installing VC++ redistribution package solved the problem for me. I'll just provide a little troubleshooting insights from my naïve perspective.
The error message is pretty clear, either the assemble CefSharp.Core.dll is missing or one of it's dependencies. So the question boils down to how do you figure out what is missing?
So first, do you have CefSharp.Core.dll? In the Solution Explorer look at the references for the project that is having this problem. You should find a reference to CefSharp.Core. If you can't find one, you're missing that assembly. If you have one, then the problem is that you're missing one of its required dependencies. When you click on the CefSharp.Core reference, in the detail, you'll get the full path to where it's located. In my case, it was in located at 'C:\Users\tom\source\repos\MyProject\src\packages\CefSharp.Common.41.0.0\CefSharp\x86\CefSharp.Core.dll'.
You then need to get a list of the CefSharp.Core dependencies to figure out which dependency your missing. Dumpbin.exe is a command line tool that you can use to get a list of dependencies. In order to use dumpbin, you need to make sure that it can be found on the path in your system environment variables. I found on the path of the VC Tools bin directory. In my case, I found one at: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64'. Open a Command Prompt terminal and navigate to the folder containing CefSharp.Core.dll and key in the following:
>dumpbin /dependents CefSharp.Core.dll
the result I got was:
Dump of file CefSharp.Core.dll
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
MSVCP110.dll
MSVCR110.dll
libcef.dll
USER32.dll
mscoree.dll
Not having worked with Microsoft Visual Studio for a number of years, I had to try and figure out where those dependencies are suppose to be located so that they can be resolved. I simply did an internet search such as "where is Kernel32.dll located" doing that for each dll until I found the missing dll. In my case, I could not find MSVCR110.dll, so I strongly suspected that was my problem. I then did an internet search for "MSVCR110.dll is missing" and found out that it was part of the vc++ redistribution. (SuperBerry, you were right on your first point). I also found that it could be downloaded from: 'https://www.microsoft.com/en-us/download/details.aspx?id=30679'. I downloaded both the x86 and x64 versions (although I only needed the x86 version for this project). They are executables that when run installs them. After installing them I found a copy of it in 'C:\Windows\SysWOW64' and in 'C:/Windows\System32'. And low and behold this problem was resolved.
What I learned from this process, was that it was difficult to know whether you have the right VC++ redistribution package installed or not. I thought I would have been installed when visual studio was installed with the VC++ features enabled. I'm using visual studio community version 2019. The project I am working with was a project I cloned from a GitHub source. I'm still confused about VC++ redistribution versioning. For example, could I have installed some later version and would it have worked (i.e. backward compatibility)?
I had the same issue. what worked for me is to add
<CefSharpBuildAction>Content</CefSharpBuildAction>
to the first PropertyGroup inside the csproj of the project you are dealing with.
I had the same issue even in release mode. Going through GitHub CefSharp FAQs, NOTE 2 solved my issue.
If compiling from source (not recommended, use the Nuget packages) and you notice that you can no longer build in debug mode, but release builds work just fine you may need to repair your version of Visual Studio. This happens in rare cases where you will get the same exact message as a missing unmanaged .dll file as shown above.
Had to repair Visual Studio and all started working as before.
For my future me, had this same issue and every time i get this error when i start my .net core 3.1 wpf application in visual studio -> Could not load file or assembly 'CefSharp.Core.Runtime.
That cost me hours!
My Solution: Don't initialize Cef in your WinForm or WPF Window class.
You need to initialize this in your startup main/app. In my example i need to add this:
public App()
{
CefSettings _browserSettings = new CefSettings();
...
Cef.Initialize(_browserSettings);
}

Can't load DLL after Windows 10 March update

This is my first question on stackoverflow, so I am open to suggestions.
I have been working on a C++/C# school project for the past few months on Visual Studio Ultimate 2013. The project is a robot simulator and we use a dll named Noyau.dll that was created for us by the teacher and lab assistants. We use P/Invoke between C# and C++ to access the libraries.
Never had a problem with Visual Studio until this last Sunday (March 13th). My computer started an update for Windows 10 and now when I try to run my program it says:
First-chance exception at 0x00007FF93DFC1F28 in InterfaceGraphique.exe: Microsoft C++ exception: EEMessageException at memory location 0x00000043C3DFE360.
A first chance exception of type 'System.DllNotFoundException' occurred in InterfaceGraphique.exe
An unhandled exception of type 'System.DllNotFoundException' occurred in InterfaceGraphique.exe
Additional information: Unable to load DLL 'Noyau.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
The only thing that happened in between when it was working and when it stopped working is the Windows 10 Update. "Noyau.dll" is compiled and it is in the right directory. The project works for my whole team. It works on my desktop computer. The project is much probably fine, my laptop seems to be the problem.
So of course, I searched for similar problems and many people suggest the use of Dependency Walker which I did. When I run "Noyau.dll" with Dependency Walker, I get that tons of dlls seem to be missing but I have no idea what these are. They seem to be core dlls. I could go and start downloading them all separately, but there are hundreds of them.
What I have tried so far:
I ran the repair tool for Visual Studio
I reinstalled Visual Studio 2013
I downloaded Visual C++ redistributable packages for visual studio 2013 x64
I ran Dependency Walker (I posted a link to a screenshot at the end of the post)
My computer is a Dell XPS13 9343 running Windows 10 Home x64.
Here is a screenshot of Dependency Walker.
I am sorry if this looks like a duplicate, but I have never seen a Windows Update break my Visual Studio or my dlls.
EDIT: Ok, I ran Dependency Walker on my .exe instead. I found that many dlls are missing in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
LoadLibraryExW("C:\Windows\Microsoft.NET\Framework64\v4.0.30319\VERSION.dll", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
I can't find these ones in the specified path but I can find them in System32:
VERSION.dll
ole32.dll
Why can't Dependency Walker find these two dlls?
FINALLY:
This is an old thread, but if anyone comes across this in the future I had to reset my laptop and reinstall VS to fix it. If anyone ever comes across this problem and finds a better solution, feel free to leave an answer here.

LibGit2Sharp fails to find git2.dll

I have built a tiny wpf app that manages a website I am working on. The key feature of this app is that it allows me to checkout different branches of a theme repository. This works perfectly in visual studio, but when I publish, install and run the app on my windows 8 machine it comes back with:
{"Unable to load DLL 'git2': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}
I have searched through the internet and stackoverflow. There are similar questions, such as Unable to load DLL 'git2.dll' The specified module could not be found but the answers provided (as well as the answers shown in the github issue described in the answer) bring up another error:
Unable to find an entry point git_reference_oid in git2.dll
I have tried installing the latest through nuget, including a compiled dll and adding the git2.dll, including the libgit2sharp project in my solution. Once again, it works perfectly when I run it all through visual studio, but fails when I publish, install and run it.
I was unsure what information needed to be included so please feel free to comment and let me know so I can update the question.
Thank you!
The computer you're running the installed executable on may lack MSVCR100.DLL or MSVCR110.DLL (depending if git2.dll has been compiled using Visual Studio 2010 or 2012).
A fix has been recently merged in libgit2 which removes the need for this dependency.
Indeed, running dumpbin /IMPORTS git2.dll against those binaries doesn't show any dependency against MSVCR1x0.dll any longer.
The latest tip of the vNext branch of the LibGit2Sharp project embeds those updated git2.dlls. It's recommended to compile the project (using the build.libgit2sharp.cmd tool and use this version (manged assembly + native binaries) instead).

Visual Studio 2012 csc.exe Error. Executable not valid for OS

I am getting the following error when trying to compile and test any type of project in Visual Studio 2012 Professional.
Error 1 The specified task executable "Csc.exe" could not be run. The
specified executable is not a valid application for this OS platform.
After testing multiple suggestions online nothing has fixed the problem. Anyone know what is causing this? Is there a new version of Csc.exe I need to get a hold of? I know this is the compiler just not sure what I need to do to fix the problem.
I had this exact problem today on my Win7 Machine. As Hans suggests, 'Navigate to C:\Windows\Microsoft.NET\Framework\v4.0.30319 and type "csc".'
The file may still exist but if you can open it with notepad, it will probably show just plain text of some errors. This is the indication that your compiler has been destroyed. At my office we have come up with a theory that a Windows update may be causing this because only a few machines have been affected, but I haven't read much online about it until now.
We fixed this by copying someone else's csc.exe into the C:\Windows\Microsoft.NET\Framework\v4.0.30319 directory and recompiling. Be sure to set the options on the file to read-only so this won't happen again. Good Luck!
The problems associated with csc.exe in Visual Studio 2012 can mostly be solved by repairing Visual Studio.
You need to repair Visual Studio. Go to Control Panel -> Programs. Then select your version of Visual Studio you are using and press "Change"(or right click it and press "Change"). When the setup appears, click "Repair".
I am on Visual Studio 2017 but this is the first google result that pops up for "csc.exe not found"
When I got this error I had to restart Visual Studio, being sure to select 'Run As Administrator'. Everything worked after that
I've faced this problem while i am trying to move Asp.Net Mvc Project from one computer to another ; error message was : The specified task executable location "c:\users\mypcname\documents\visual studio 2015\Projects\TestMVC\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\csc.exe" is invalid.
I solved this by
Creating new Mvc Project ;
going to that folder \Microsoft.Net.Compilers.1.0.0\build..\tools
and Copied the csc.exe file to my Projets >> \Microsoft.Net.Compilers.1.0.0\build..\tools\
i think when i was copying the project from the original Computer i left that csc.exe file in the specified folder.
Hope this will help someone.
Check your solution properties (right-click on Solution and select 'Properties') and make sure that the 'platform' field (Configuration Properties) is set correctly.
I think this problem is caused due to improper PC clean up. I was running Quick Heal PCTuner 3.0 software on a 64-bit windows 7 machine but suddenly due to loss of power my machine was shut down then when i opened it again I was getting this problem in VS 2013. Even TortoiseSVN checkout was not working and throwing internal error and something like corrupted disk also was shown when trying to delete some files on the harddisk.
I ran the PC Tuner again doing the Disk, Registry and traces clean up and it got fixed. maybe this problem may occur due to other cases also but is mostly related to the system's files In my case this is the fix
Regards.
in my case helped (I had .net framework 4.5.1 and vs c# 2010 express):
download the newest .net framework and run repair
On Visual Studio 2013, the same problem solved by doing this for me:
Right click the solution and open Configuration Manager. For the project(you may see at least one there), I've changed the Platform from Any CPU to x86 for the project that may causing the problem.
I've tried to delete and move csc.exe file but it doesn't do anything.
Then simply I upgrade .net version and than downgrade (returned to its original state) and it works.
I solved my problem by copying the whole folder containing my visual studio solution
From C:\Users\me\Google Drive...
To: C:\Users\me\OneDrive...

Categories