WinForm CefSharp - c#

I just tried to install CefSharp on a new winForm application, i install the latest version with Nuget and done all the steps by this article:
https://ourcodeworld.com/articles/read/173/how-to-use-cefsharp-chromium-embedded-framework-csharp-in-a-winforms-application
Running on : "Any CPU"
Visual Studio 2013
CefSharp 69.0.0
When i run the application i get this error:
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.
This is the code:
var settings = new CefSettings();
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
Any idea what is the problem?
EDIT
This is the app.config file of my project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="x86"/>
</assemblyBinding>
</runtime>
</configuration>

In our case this happened when we failed to install the Visual C++ runtime.

In app.config file , please check dependentAssembly segment for CelfSharp.
If it has any entry, make sure that the version of added reference be in valid range.

Related

C# add reference under specific folder issue

I'm using Visual Studio 2019 Community Edition. After I added the reference under subdir with copy local set to true, it works fine, then I modified the app.config to
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Mylib\"/>
</assemblyBinding>
</runtime>
</configuration>
thinking this may not require copy to local anymore, then I got
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Isn`t this the proper way to add subdir reference? (By the way, there is only *.dll.config but not *exe.config generated when I added item 'App.config' )
I finally found out that the problem here is the project type part, it seems that .net core does not support these traits, so I changed my project to console(.netframework) then the modifying app.config route works.

Assembly probing private path in new csproj format

I've recently finished converting a WPF project to the new csproj format which is much leaner.
However I have one missing piece left, adding a probing path for the assemblies, something that used to exist in the old app.config file. With this missing my application just doesn't find the required dlls.
The way I have this set up is with a Post-build event that clears and moves items to a bin folder:
SET folder=bin
rmdir "$(TargetDir)%folder%" /s /q
mkdir "$(TargetDir)%folder%"
move "$(TargetDir)*.dll" "$(TargetDir)%folder%\"
I've tried adding some entries to the .csproj file but to no avail. I believe this is more for compiling the application:
<PropertyGroup>
<ReferencePath>bin</ReferencePath>
</PropertyGroup>
<PropertyGroup>
<AssemblySearchPaths>
$(AssemblySearchPaths);
$(ReferencePath);
</AssemblySearchPaths>
</PropertyGroup>
I guess my main question, should I still have an app.config, or is there a better .csproj approach available?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin"/>
</assemblyBinding>
</runtime>
</configuration>
My application will work if I include it, but I'd like to know if I can simplify this, or do this in a better way in general.

Exception with crystal reports

I am developing application which uses SAP Crystal Reports for reporting with Visual Studio 2013 Professional.
I downloaded and install package from SAP site, install that. Report is prepared using wizard (this works correctly). Problem is if I following step in source code:
myCrystalReport.SetDataSource(myDataSet);
myDataSet is filled with required data. Displayed error is:
An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in mscorlib.dll
Additional information: Could not load file or assembly
'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports
for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI
4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies.
During installation folder dotnet1 were not created. There is only folder dotnet.
Do somebody know how can be this problem resolved?
Thank you.
I had the exact same problem. My solution was to add this xml to the app.config file inside the <configuration> level:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
See also:
CRVS2010- crdb_adoplus.dll not found
Could not load file or assembly crdb_adoplus.dll
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
</startup>
</configuration>
Due to mixed mode assemblies has changed this problem will occur so it is recommended to you use above code into app.config file.
you have use below code in app.config and also have to set .net profile 4 client to .net profile 4 or 4.5 in project property.
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
All above solution not working in my project and application goes in break mode. i solve this problem by adding following lines in app.config inside the configuration.
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime

I got this exception after runing an execuable in command line execution:
"Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."
After search this issue on internet, I found one of the way out is to configure App.Config file.
That works fine in VS2010 but still generates same error in command mode.
So is there any way to resolve this by using command line as generating newer version of .dll is impossible.
Thanks!
You can also try useLegacyV2RuntimeActivationPolicy="true"
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
Make sure you have configured both the App.config and the ProgramName.exe.config file.
For example:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Another solution can be to recompile all mixed(C++/CLI) assemblies you are dependent on for .NET 4.0. It is often not possible if these assemblies are third party.

FileLoadException with .NET 4

I'm trying to build an application using the OpenNURBS toolkit (see here) and I'm getting a FileLoadException with the following message while debugging:
Mixed mode assembly is built against
version 'v2.0.50727' of the runtime
and cannot be loaded in the 4.0
runtime without additional
configuration information.
The OpenNURBS toolkit is the only non-System assembly in the project at this point, so I know the problem is with that file. Where and what are these supposed configuration options? Any help would be appreciated.
You need to add the following config to the app.config file:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
For details:
<startup> Element # MSDN

Categories