I am trying to build a project using opencvsharp v2.4 64x in Visual Studio 2012. The project is built using .net 4.5 and x64 target. I've installed VS08+VS10 sp1 prerequisites. i've included all the opencv dlls (version 2.4.0 64x) in my project to copy to executable directory including TBB.dll (and checked that they actually end up in the correct folder).
However, on running the software i get the error: An exception has occurrred because of P/Invoke. Please check the following ... System.DllNotFoundException: Unable to load DLL 'opencv_core204' ... etc
any ideas why this is happening? maybe VS2012 is not supported to build opencvsharp 2.4?
Seems like i still missed out a few native dll's which code204 was dependent on.
here is the complete list that is required. It now works in visual studio 2012 with 64-bit and .net 4.5 - however a few examples wont run (delaunay) using 4.5 but only in 3.5. no idea why...
OpenCvSharpExtern.dll
OpenCvSharpExternGpu.dll
opencv_calib3d240.dll
opencv_calib3d240d.dll
opencv_contrib240.dll
opencv_contrib240d.dll
opencv_core240.dll
opencv_core240d.dll
opencv_features2d240.dll
opencv_features2d240d.dll
opencv_ffmpeg240.dll
opencv_ffmpeg240_64.dll
opencv_flann240.dll
opencv_flann240d.dll
opencv_gpu240.dll
opencv_gpu240d.dll
opencv_highgui240.dll
opencv_highgui240d.dll
opencv_imgproc240.dll
opencv_imgproc240d.dll
opencv_legacy240.dll
opencv_legacy240d.dll
opencv_ml240.dll
opencv_ml240d.dll
opencv_nonfree240.dll
opencv_nonfree240d.dll
opencv_objdetect240.dll
opencv_objdetect240d.dll
opencv_photo240.dll
opencv_photo240d.dll
opencv_stitching240.dll
opencv_stitching240d.dll
opencv_ts240.dll
opencv_ts240d.dll
opencv_video240.dll
opencv_video240d.dll
opencv_videostab240.dll
opencv_videostab240d.dll
QtCore4.dll
QtGui4.dll
tbb.dll
tbbmalloc.dll
tbbmalloc_debug.dll
tbbmalloc_proxy.dll
tbbmalloc_proxy_debug.dll
tbb_debug.dll
tbb_preview.dll
tbb_preview_debug.dll
Related
I have upgraded from Windows 7/Visual Studio 2015 to Windows10/Visual Studio 2019.
I wish to create a C# COM object which I can call from Excel(365) VBA code.
Using Win 7/Visual Studio 2015 the following very simple code compiles as a C# class library and creates a COM object that I can call successfully from Excel 2013 VBA:-
using System.Runtime.InteropServices;
namespace TestLib {
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class C_Hello {
public string Hello() {
return "Hello";
}
}
}
In the Assembly Info I have ticked the checkbox "Make the Assembly COM Visible" and in the Build info I have ticked the checkbox "Register for COM interop"
The Excel 2013 VBA code is equally simple:
Sub Test()
Dim x As TestLib.C_Hello
Set x = New TestLib.C_Hello
ActiveSheet.Range("C3").Value = x.Hello
End Sub
where TestLib is the C# COM module created in Visual Studio.
In the Win 7/VS2015/Excel 2013 environment everything works fine, but under after transferring and compiling under Win 10/ VS2019 the Excel 365 VBA code errors at the line:-
Set x = New TestLib.C_Hello
with the error message
Run Time error '-2147221164 (80040154)'
Class not registered
Can anyone tell me what I have to do to get this working in the Windows 10 / VS2019 / Excel 365 environment.? Is it Windows 10 or Visual Studio 2019 that is doing things differently?
Make sure the bitness of excel matches your build in VS. You will likely need to add an x86 or x64 build for your project.
It is possible to register an AnyCpu assembly, but visual studio does not do so with the “Register for COM interop” for both. You can manually do so by running both the 32- and 64-bit versions of regasm manually or from a post-build script.
Failing that, you might use ProcMon to check what registration or file Excel is looking for and not finding. Warning, though, that unless you are familiar with the “normal” errors which occur when running it is easy to troubleshoot a red herring. I would recommend filtering by “Path” contains “TestLib.C_Hello” then chase it from there.
The solution in the Win10 / VS2019 environemnt was to change the Platform Target in VS's Build Tab from Any CPU to x64, and then it worked.
In the Win7 / VS2015 environment a Platform Target of Any CPU worked fine.
i m trying to build COM dll file using C# and VS2010 - framework 3.5-:
if i try building the project without performing Clean, it will build, however this works only before any cleaning operation, after cleaning the project i will get stuck with this error
Error 16 Cannot register assembly "C:\Users\User\Desktop\Demo[Demo]
SCPP T1\bin\Debug\PrinterPlugin.dll" - access denied. Please make sure
you're running the application as administrator. Access to the
registry key
'HKEY_CLASSES_ROOT\CLSID{B9162A23-45F9-47CC-80F5-FE0FE9B9E1A2}' is
denied. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 3912 5 PrinterPlugin
i have based the original files on FrameWork 4.0 then converted to 3.5 due to COM registration incompatibility. building with Framework 4.0 will build successfully but will produce "TYPELIB" file is missing while registering the library.
further elaboration, the old PrinterPlugin works like a charm based on framework 3.5, it would register correctly, and would function with no warnings or erros of what-so-ever, these errors started popping after adding some components from another SDK that have been distributed using framework 4.0 and uses other microsoft libraries, like bidispl.dll, ReachFramework... etc.
EDIT0
i already have tried starting the VS2010 as admin, from every location.
EDIT1
i have tried building a new project using Framework 3.5, and still facing the same error, even when executing the devenv.exe as admin from the Common7 > IDE folder.
Error 18 Cannot register assembly
"C:\Users\Ameer\Desktop\projects\PrinterPlugin without resize
17-05-2015\printerplugin without resize
10-05-2015\bin\Debug\PrinterPlugin.dll" - access denied.
Please make sure you're running the application as administrator.
Access to the registry key
'HKEY_CLASSES_ROOT\CLSID{B9162A23-45F9-47CC-80F5-FE0FE9B9E1A2}' is
denied. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 3912 5 PrinterPlugin
i m guessing this is something has to do with the compatibility between the two SDKs.
I have a program that interfacing SWI-Prolog in Visual Studio. Previously, I used VS2010 (XP) and everything works fine. Then I upgrade my VS to become VS2012 (Win7) and now I have a problem in my code.
When it comes to the following code:
PlEngine.Initialize(param);
it always gives me the following exception message:
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Can anybody spot what mistake that I made or if possible some modification that I have to do, due to the upgrading process?
Additional information regarding my code:
I used the most updated swiPLCs library (version: 1.1.60301.0)
my 'param' in my code above is: string[] param = { "-q", "-f", #"c:\program files (x86)\pl\"};
I have set the path environment variable to: c:\program files (x86)\pl\ and c:\program files (x86)\pl\bin
I have this setting in my code: Environment.SetEnvironmentVariable("SWI_HOME_DIR", Global.g_prologLocation);
I had the reference to: swiPLcs.dll
I already tried to use the SWIProlog 64 bit, but I still have the same problem
Any help is really appreciated.
Many thanks
I finally got the answer myself.
Unlike VS2010, In VS2012 it seems that you have to add SWI-Prolog package into VS2012.
So add SWI.Prolog package using Nuget.
How?
See: https://nuget.org/packages/SWI.Prolog
And VS2012 will recognize the SWI.Prolog now.
Thanks anyway
I used IBM.Data.DB2 version=9.7.4.4 and everything worked perfectly.
But I couldn't use a performance profiler and the support told me I should try
with new IBM version = 10.1. I installed it and had problems at first. I had to register a reference to it in GAC, etc.
Now to my question: If I browse to C:\Program Files\IBM\SQLLIB\BIN\netf40_32\IBM.Data.DB2.dll
and look properties I have version: 10.1.0.4 but when I add reference in visual studio
I have version = 9.7.4.4 in the property window and I am not sure if the right version is used.
How do I get
the right version into property window in visual studio?
I solved this problem by using the IBM.Data.DB2.dll from C:\Program Files\IBM\SQLLIB\BIN\netf40_32\specific\IBM.Data.DB2.10.1.0.dll.
So I got the right version, then I had SQL1159 initialization error with db2 .net data provider reason code 2. The db2app.dll was searched in wrong directory (File not found: http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.messages.sql.doc/doc/msql01159n.html)
I reinstalled the db2 client and now it works...
I ran into compilation problems with my MSVS 10 after installing MSVS 11Beta. Now, when I compile my C# Projects in MSVS 10 (Projects created in MSVS 10; Target framework: 3.5), I get errors MSB4216, MSB4028 with following text in output window:
1>Task "GenerateResource" skipped, due to false condition; ('%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' != 'CLR2') was evaluated as ('Resx' == 'Resx' and '' != 'false' and 'CLR2' != 'CLR2').
1>Task "GenerateResource"
1> Launching task "GenerateResource" from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" in an external task host with a runtime of "CLR2" and a process architecture of "x86".
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2199,5): error MSB4216: Could not run the "GenerateResource" task because we could not create or connect to a task host with runtime "CLR2" and architecture "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NetFX 4.0 Tools\MSBuildTaskHost.exe" exists.
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2217,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.
1>Done executing task "GenerateResource" -- FAILED.
How can I fix these errors?
EDIT:
Mentioned file "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NetFX 4.0 Tools\MSBuildTaskHost.exe" exists.
C++ projects are compling without problems.
Reinstalling VS10 doesn't solve the problem.
This is GenerateResource task, that must compile resx-file, but generates an exception:
<!-- But we can't use those parameters if we're targeting 3.5, since we're using the 3.5 task -->
<GenerateResource
Sources="#(EmbeddedResource)"
UseSourcePath="$(UseSourcePath)"
References="#(ReferencePath)"
AdditionalInputs="$(MSBuildAllProjects)"
NeverLockTypeAssemblies="$(GenerateResourceNeverLockTypeAssemblies)"
StateFile="$(IntermediateOutputPath)$(MSBuildProjectFile).GenerateResource.Cache"
StronglyTypedClassName="%(EmbeddedResource.StronglyTypedClassName)"
StronglyTypedFileName="%(EmbeddedResource.StronglyTypedFileName)"
StronglyTypedLanguage="%(EmbeddedResource.StronglyTypedLanguage)"
StronglyTypedNamespace="%(EmbeddedResource.StronglyTypedNamespace)"
StronglyTypedManifestPrefix="%(EmbeddedResource.StronglyTypedManifestPrefix)"
PublicClass="%(EmbeddedResource.PublicClass)"
OutputResources="#(EmbeddedResource->'$(IntermediateOutputPath)%(ManifestResourceName).resources')"
MSBuildRuntime="$(GenerateResourceMSBuildRuntime)"
MSBuildArchitecture="$(GenerateResourceMSBuildArchitecture)"
Condition="'%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' == 'CLR2'">
I tried to debug MSBuild script (.csproj). Just before the fatal GenerateResource task I checked all the properties and items. There was nothing about "8.0A" but only about "7.0A"
There is an ugly way to fix the problem: renaming folder "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A". I hate to accept this answer.
How long is your username?
It seems that there is a bug when the username is 20 characters long. If your username is 19 characters or less it works fine.
I have opened an issue on connect.
Edit:
Have you tried setting the environment variable DisableOutOfProcTaskHost to true as suggested in the connect issue, that worked for me.
A similar questin was asked on the MSDN forums. Did you reboot after installing VS11?
http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/7d955d96-ff73-47d3-8830-85ea321eb4ab
This issue occurred for me on my TFS 2010 build server after installing VS2010 and then installing .NET Framework 4.5. This allowed me to build .NET 4.5 projects but any VS2008 project targeting CLR2 (.NET 2.0 -3.5) I attempted to build would return the error. None of the suggestions on the handful of sites talking about this issue worked.
Rebooting - Did not fix the issue
Setting DisableOutOfProcTaskHost = true in an environment variable and also within the project file - Did not fix the issue
Username of my build account was already less than 20 characters
Renaming windows SDK folder - N/A since I did not have VS2012 and the 8.0A SDK installed... just .NET framework 4.5.
In any case, to fix this I uninstalled .NET 4.5, repaired VS2010, and then rebooted the build server. Now I am able to build VS2008 and VS2010 projects with no issues.
Luckily I no longer need to build .NET 4.5 projects as that team decided to go back to .NET 4.0.
Another possible fix is to change the target framework of your projects to .Net 4.0. It's not always a solution, but it certainly is a possibility if all else fails.
Worked for me: Removing the bin and obj folder for problematic folders and restarting the solution
In my case, I received that error message when trying to build a solution on a 32-bit Windows 7 machine. The way to resolve the error for me was to right-click on the project, choose properties, then go to the Build tab. In here I changed the "Platform target" from "Any CPU" to "x86". HTH
Setting Setting DisableOutOfProcTaskHost = true in an environment variable worked for me.