PIP build does not include other dll's - ocean

WHen doing a PIP build it will copy in the solutions other projects outputs from the DeployList.xml but for a different project outside of this solution I only copied in the dll. However it does not like this and throws an error:
Ignored C:\Test.dll because it cannot be loaded properly due to:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Source: Slb.Ocean.Core
I have also included other files and it copies them in just fine. It just seems to have an issue with dll's and exe's.

If the .dll you are trying to add is a native DLL (without a managed header), the PluginPackager displays the warning message you have given, like this one when trying to add Inventor.dll:
Ignored D:\Program Files\Schlumberger\Petrel 2012\Extensions\OceanLab\Inventor.dll because it cannot be loaded properly due to:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Source: Slb.Ocean.Core
[though you would never need to include any .dlls that are part of Petrel, this is just an example]
However, these messages do not keep the .PIP from building, nor do they keep the referenced native .dlls from being included in the generated .PIP file.
There is a enhancement requirement recorded to clean up these misleading messages.

Related

Fake/Paket "specified module could not be found" in build file

I created the following Github repo to document the problem:
https://github.com/red-swan/fake-sqlite-problem
I am unable to build sqlite databases from an F# FAKE file relying on Paket. Adding the nuget package System.Data.SQLite to the paket.dependencies means I can open System.Data.SQLite but when attempting to build a database from the build.fsx file, I get the following error:
(Unable to load DLL 'SQLite.Interop.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E))
SQLite.Interop.dll is a located in dependency runtimes\win-x64\native\netstandard2.0 of System.Data.SQLite's dependency System.Data.SQLite.Core. Trying to reference it directly with and #r statement in the build.fsx fails with the error:
Error opening binary file ... bad cli header, rva
I'm not sure how everything is supposed to resolve, but running the database creation from an actual fsproj works just fine, so I believe it has do with the FAKE or Paket resolution.
If you are familiar with FAKE, does this sound reasonable? Do you know how to fix this?
To reproduce the error:
git clone https://github.com/red-swan/fake-sqlite-problem.git
The above comment by TeaDrivenDev has the solution. I'm putting the answer here so I can close the question.
To be specific, I found the Native dll SQLite.Interop.dll and dropped it into the root folder where the FAKE build.fsx file is. The article TeaDrivenDev references has alternative methods as well.

Team Foundation Server unable to build. Missing libraries or components?

I am trying to create a build using TFS and a build server. This is my first attempt with the build server and it is not going well!!
I am using Visual Studio 2012 and TFS 2012.
The project is written in VB.Net and uses a fair number of references. When I build the project on my dev machine I have no issues; but then I have Outlook 2013 installed and all the various required components.
When I send the project off to the build server I am getting many warnings about missing types that pertain to outlook plus a couple of mystery library's.
I cannot put outlook on the build server; so how do I resolve this problem?
here are some of the messages.
er.vb (45): Type 'Outlook.Recipient' is not defined.
er.vb (42): Type 'Outlook.NameSpace' is not defined.
er.vb (39): Type 'Interop.Outlook.Application' is not defined.
rs.vb (1141): Type 'Interop.Outlook.Attachment' is not defined.
rs.vb (1144): 'Outlook' is not declared. It may be inaccessible due to its protection level.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1988):
Cannot get the file path for type library "2df8d04c-5bfa-101b-bde5-00aa0044de52" version 2.7. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1988):
Cannot get the file path for type library "00062fff-0000-0000-c000-000000000046" version 9.5. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
The bottom 2 messages are not Outlook related, frankly I am unsure what it is looking for there?
The final message from the attempted build is:
Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I'm assuming I am receiving this because of the various missing components?
Any assistance would be greatly appreciated.
You most likely have a number of references that only exist in your GAC or are in your local program files tree.
Open up your project files in a text editor add see if there are.
You need to replace these with lib references from your source tree in one of two ways.
Nuget packages (recommended). Add packages/dll required
lib folder (older method). Create a folder in your source tree and drop in the dlls that you require.-
If your update your references and then update your scm. Your build should then be self contained and build.
Installing large software packages on a build agent to fix a dll reference is bad practice and a build agent should be left as clean as possible.
A source tree should contain all links/info to what is needed to build it. (except maybe the .dot net framework)

Reference VB.NET DLL in Kofax Document Validation Script

We are working on a validation script for Kofax Capture 9.0 / 10.0 in VB.NET 3.5.
We know how to create a script using the Admin Module, and how to get it operational.
The problem is that we need to reference a dll, located on a remote machine. (GAC is no option) This dll holds abstract classes we need in each validation script.
Even when putting the dlls locally (copy local), the Validation Module (index.exe) immediately throws the "cannot find reference" exception, even though the project compiled perfectly.
I guess the basic question comes down to: where do we put the dlls, in order for the Validation Module to find them?
The simple answer is to put the dll in the same folder as the application because this is one of the places which .NET will probe when trying to find it. The Validation module is run from the Capture bin directory which will be something like "C:\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin\". This would need to be done on each client using Validation.
If you have a more complicated scenario, you could look implementing the AppDomain.AssemblyResolve Event and using Assembly.LoadFile to get the assembly from a custom location, but the using the bin path is less complicated.
If you end up having further trouble, you can troubleshoot by using the Assembly Binding Log Viewer (Fuslogvw.exe) which can tell you more details about why the assembly failed to load and where .NET tried to search for it. Assembly loading can fail for reasons other than just the path.
For more detail on how .NET loads assemblies, see the following:
How the Runtime Locates Assemblies
Locating the Assembly through Codebases or Probing
We found a solution: add all library files as "links" to the project. (Add --> Existing File --> small arrow next to "Add" --> Add as Link)
This ensures the files are compiled when you build the project. The Kofax Validation Module can now find the files, whereas when referencing the file, it could not. Why it could not, remains a mystery...

Problems registering a dll

I am trying to register a .dll file but I am getting an error. The .dll is in the SysWOW64 folder, through the command line I then cd \Windows\SysWOW64 and run the following command regsvr32 php_sdo.dll
I then get the following error:
"The module "php_sdo.dll" failed to load.
Make sure the binary is stored at the specified path of debug it to check for problems with the binary or dependent.DLL files.
The specified module could not be found"
This kind of failure often occurs when one of the dependency of the DLL one wants to register (which physically means, that the program that attempts to register the DLL internally calls LoadLibrary) is missing. You can have a look at the dependency (tree) of your DLL using Dependency Walker.

Missing MySQL DLL?

I've recreated the Northwind Spring/NHibernate example that comes with Spring.NET, but with MySQL rather than SQLServer. I've almost got it working I think, but I'm getting this when I try to use Hibernate to load something from the database
A first chance exception of type 'System.IO.FileNotFoundException'
occurred in mscorlib.dll NHibernate.Util.ReflectHelper:
ERROR lambda_method - Could not load type
MySql.Data.MySqlClient.MySqlCommand, MySql.Data.
System.IO.FileNotFoundException: Could not load file or assembly
'MySql.Data' or one of its dependencies.
The system cannot find the file specified.
File name: 'MySql.Data'
Every project (DAO, Service, Web) has a reference to the MySQL.Data DLL so I'm a bit unsure what's going on.
Can anyone help me please?
Make sure that MySQL.Data.dll actually got copied to the output folder. And that you are using right platform (x32 vs x64 bit) and right version of .NET (2,3,3.5 vs 4). If everyhing seems fine, enable Fusion Logging and take a look at this article:
For FileNotFoundException: At the bottom of the log will be the paths
that Fusion tried probing for this assembly. If this was a load by
path (as in Assembly.LoadFrom()), there will be just one path, and
your assembly will need to be there to be found. Otherwise, your
assembly will need to be on one of the probing paths listed or in the
GAC if it's to be found.
You may also get this exception if an unmanaged dependency or internal
module of the assembly failed to load. Try running depends.exe on the
file to verify that unmanaged dependencies can be loaded. Note that if
you re using ASP.NET, the PATH environment variable it's using may
differ from the one the command line uses. If all of them could be
loaded, try ildasm.exe on the file, double-click on "MANIFEST" and
look for ".file" entries. Each of those files will need to be in the
same directory as the manifest-containing file.