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

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)

Related

Cannot find the reference specified-Visual Basic 2013

I've got a new system. I am trying to connect to and run the system through a 64-bit Windows 7 PC. The company sent me a Visual Basic project for that. It uses .NET framework 4 and Windows Form Applications. The target CPU is x86.
In the References tab, next to three of the COM references there are "The system cannot find the reference specified" statements. When built, the project gives the namespace errors and warnings because of these objects. The other references work fine. I've then seen those .dll files in the debug folder. I think they are generated by the company before sending me. They also exist in the bin\debug folder.
I've removed the three from the references list in the project and tried the following separately:
1) In the project, refer to the .dll files that exist in the debug folder. (Seems a fake way, but removes all the errors when the project is built. When debug, it gives the "Retrieving the COM class factory for component with CLSID ... failed due to the following error: 80040154" error.)
2) Copy the .dll files in the debug folder to C:\Windows\SysWOW64 folder, then register through regsvr32 "name.dll" in the console as admin. This way, I get the ".dll was loaded, but the DllRegisterServer entry point was not found" error. (In the regedit window, the registry editor cannot find the ID's of those references that are seen in the project properties in VB.)
3) Do the item (2), but with the C:\Windows\System32 folder instead of SysWOW64. The same error when registering.
4) Changed the solution platform to x86 and tried the items 1,2, and 3. Still the same errors.
Do I have to register these dll files? And, am I supposed to register exactly these dll files that exist in the debug folder? Or are they supposed to be generated after build by referring to some 'missing' type libraries in the references tab? I don't have these type libraries, though.
All suggestions are welcome ASAP. Thanks in advance.
You have three Interop dlls for your project, correct? These dlls just allow you to use a COM dll without having to talk directly to the COM dlls yourself.
Referencing the dlls in the bin/Debug directory should be fine, since those are probably the correct dlls that the project was built with. However, you will want to move them to another folder before continuing.
What you need to get from the company that sent you the project is the original COM dlls and their dependencies, if any. Usually an interop dll is called Microsoft.Phone.Interop.dll where it is performing interop with Microsoft.Phone.dll. Microsoft.Phone.dll needs to be registered on your computer using regsvr32 and then you just need a reference to the interop dll.

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...

PIP build does not include other dll's

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.

How do I get TFS teambuild to build c#>VB6>c# application (ComReference prob?)

I'm trying to get TFS team-build to reliably build a WPF C# app. This app relies on a VB6Lib.dll which we maintain, this VB6Lib.dll itself relies on other C# libs that we also maintain.
I've set up a build definition to build (in order):
VbDependencies.sln (all libs in this have com interop set, thus the VB6 can find their TLBs)
buildVB6Lib.proj (an msbuild file which calls "VB6.exe /make /d" to make the VBLib.dll on the build server, as part of this script I've been copying the VB6Lib.dll output to C:\tmp)
MainApp.sln (in my workspace, I've added a reference to C:\tmp\VB6Lib.dll)
Does this sound ok
?
On my dev laptop I usually build the VB6, copy its output to \tmp and then regsvr32 it there before adding a reference to it in my C# solution. It's this step that I'm not convinced my build def is doing.
Also, is there a way to get more useful output from the VB6 build, currently I get "Compile Error in File 'xxx.bas' Can' find project of library", but not which actual library it can't find.
You are correct in that the critical point in your build process on the development system lies in registering the COM object. However, one does not in general want to register the COM object on the build server, as this can cause all kinds of versioning issues and silent failures when the wrong COM object is registered or the registration fails.
The proper way to accomplish this is to generate an interop assembly manually and reference that instead of the COM object. This is accomplished with the tlbimp utility, for instance:
tlbimp ..\Libraries\VBLib.dll /out:..\Libraries\Interop.VBLib.dll
Run that command on your development system, then remove the reference to VB6Lib.dll and add a reference to Interop.VBLib.dll. You can then add the tlbimp command as a prebuild event in the referencing project so that the interop assembly is always build from the correct version, and you will never again need to have your COM object registered on the build system.

VB.Net project shows errors on clean in VS2010

my issue is very similar to:
http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-vb/54944/VB-Net-project-throwing-errors-when-executing-Clean-Solution
Typical errors: Unable to load referenced library X
Type IWshRuntimeLibrary.WshShell is not defined.
Interface System.IDisposable is not implemented by this class.
Namespace of type specified in the Imports Z does not contain any public members or cannot be found. Make sure the imported element name does not use any aliases.
This must have to do with a VB.net project configuration. Currently there is a setting "Treat all warnings as errors". I would like to keep that setting, but also resolve these annoying "errors".
I've experienced a similar problem and fixed it by running the following command in the VS command line tool
devenv /resetskippkgs
I'ev had problems executing Clean's via MSBuild in VS2008 when projects were registered for COM interop.
The problem is that the "Clean" target auto-generated for a solution cleans projects in the same order in which they were built.
This causes problems for projects registered for COM when MSBuild attempts to load and then unregister the assembly from COM during a "Clean".The issue occurs if the assembly has a dependency on another project because the dependency will be deleted first and therefore loading the assembly will fail and MSBuild will be unable to unregister it.
A workaround is to change the solution .cache file (which contains the targets auto-generated by MSBuild during "Build") and reverse the order of the "Clean" target. I hacked-together a quick-fix custom build task to do this as a post-build step.
No idea if this was fixed in VS2010 or indeed if this matches your problem since you don't give many specifics in your question ;)