Skip to content

App.Config, Build Fix for Visual Studio 2017, Tips and Tricks

Atiq Rahman edited this page Mar 17, 2018 · 2 revisions

App.Config

I found this by trial and error. To build the binary App.Config is used. Once the executable is built the file is not used or not looked up by the executable. Therefore, you have to make sure to apply correct settings in App.Config before building vault2git. Here's an example of working App.Config configuration file,

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="Vault.Server" value="97.107.13.73"/>
    <add key="Vault.User" value="atiqv"/>
    <add key="Vault.Password" value="vault-password"/>
    <add key="Vault.Repo" value="myCoolApp"/>
    <add key="Git.DomainName" value="fftsys.com"/>
    <add key="Convertor.WorkingFolder" value="D:\git_ws\myCoolApp"/>
    <add key="Convertor.GitCmd" value="C:\Program Files\Git\bin\git.exe"/>
    <add key="Convertor.Paths" value="$/Projects/myCoolAppProject~master"/>
  </appSettings>
</configuration>

If I had multiple versions as multiple projects I would modify key Convertor.Paths to import them all into separate branches,

<add key="Convertor.Paths" value="$/Projects/myCoolAppProject~master;$/Projects/myCoolAppProject-Beta~beta;;$/Projects/myCoolAppProject-Alpha~alpha"/>

Tips and Tricks

To remove verbose information from commit log,

fixed the bug that was hidden in my closet
[git-vault-id] MyCoolApp$/Projects/MyCoolAppRelease@142/31889

As you can see second line is too verbose, which can seem redundant in same branch. For example above, I would rather provided a commit log as,

fixed the bug that was hidden in my closet @142/31889

To accomplish I change the method buildCommitMessage in Processor.cs. Here is the change,

--- a/Vault2GitLib/Processor.cs
+++ b/Vault2GitLib/Processor.cs
@@ -502,10 +502,13 @@ namespace Vault2Git.Lib
         private string buildCommitMessage(string repoPath, long version, VaultVersionInfo info)
         {
             //parse path repo$RepoPath@version/trx
-            var r = new StringBuilder(info.Comment);
-            r.AppendLine();
-            r.AppendFormat("{4} {0}{1}@{2}/{3}", this.VaultRepository, repoPath, version, info.TrxId, VaultTag);
-            r.AppendLine();
+            var r = new StringBuilder();^M
+            if (!string.IsNullOrEmpty(info.Comment)) {^M
+                r.Append(info.Comment);^M
+                r.AppendLine();^M
+            }^M
+            r.AppendFormat("@{0}/{1}", version, info.TrxId);^M
+            //r.AppendLine();^M
             return r.ToString();
         }

Additionally, as you can see in code above I removed additional new lines.

Build Fix for Visual Studio 2017

VS 2017 gave me following,

The type or namespace name 'VaultClientIntegrationLib' could not be found (are you missing a using directive or an assembly reference?)	Vault2GitLib Active

one of those general missing directive errors,

the type of namespace could not be found (are you missing a using directive *)

To make it work with VS 2017 I had to remove following references for project Vault2GitLib

  • VaultClientIntegrationLib.dll
  • VaultClientNetLib.dll
  • VaultClientOperationsLib.dll
  • VaultClientUILib.dll
  • VaultLib.dll

I had to add those references again. Here's summary of list of modified dll files,

  • Vault2GitLib/libs/VaultClientAPI_4_0_6_15954/DragnetLib.dll
  • Vault2GitLib/libs/VaultClientAPI_4_0_6_15954/VCDiff.dll
  • Vault2GitLib/libs/VaultClientAPI_4_0_6_15954/VaultClientIntegrationLib.dll
  • Vault2GitLib/libs/VaultClientAPI_4_0_6_15954/VaultClientNetLib.dll
  • Vault2GitLib/libs/VaultClientAPI_4_0_6_15954/VaultClientOperationsLib.dll
  • Vault2GitLib/libs/VaultClientAPI_4_0_6_15954/VaultLib.dll

Afterwards, I cleaned the solutions and rebuilt again.

I used Vault Client Standard 8.0.1. When I analyzed the dll file it gave me following info, dumpbin /dependents VaultClientIntegrationLib.dll Microsoft (R) COFF/PE Dumper Version 14.13.26128.0 Copyright (C) Microsoft Corporation. All rights reserved.

Dump of file VaultClientIntegrationLib.dll

File Type: DLL

  Image has the following dependencies:

    mscoree.dll

  Summary

        2000 .reloc
        2000 .rsrc
       1A000 .text

 > dumpbin /summary VaultClientIntegrationLib.dll
Microsoft (R) COFF/PE Dumper Version 14.13.26128.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file VaultClientIntegrationLib.dll

File Type: DLL

  Summary

        2000 .reloc
        2000 .rsrc
       1A000 .text

 > dumpbin /all VaultClientIntegrationLib.dll
Microsoft (R) COFF/PE Dumper Version 14.13.26128.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file VaultClientIntegrationLib.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
             14C machine (x86)
               3 number of sections
        54C123B6 time date stamp Thu Jan 22 08:22:14 2015
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
            2102 characteristics
                   Executable
                   32 bit word machine
                   DLL

OPTIONAL HEADER VALUES
             10B magic # (PE32)
           11.00 linker version
           19000 size of code
            2000 size of initialized data
               0 size of uninitialized data
           1AAAE entry point (1101AAAE)
            2000 base of code
           1C000 base of data
        11000000 image base (11000000 to 1101FFFF)
            2000 section alignment
            1000 file alignment
            4.00 operating system version
            0.00 image version
            4.00 subsystem version
               0 Win32 version
           20000 size of image
            1000 size of headers
           2B57E checksum
               3 subsystem (Windows CUI)
            8540 DLL characteristics
                   Dynamic base
                   NX compatible
                   No structured exception handler
                   Terminal Server Aware
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
               0 [       0] RVA [size] of Export Directory
           1AA60 [      4B] RVA [size] of Import Directory
           1C000 [     490] RVA [size] of Resource Directory
               0 [       0] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
           1E000 [       C] RVA [size] of Base Relocation Directory
           1A928 [      1C] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Global Pointer Directory
               0 [       0] RVA [size] of Thread Storage Directory
               0 [       0] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
            2000 [       8] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
            2008 [      48] RVA [size] of COM Descriptor Directory
               0 [       0] RVA [size] of Reserved Directory


SECTION HEADER #1
   .text name
   18AB4 virtual size
    2000 virtual address (11002000 to 1101AAB3)
   19000 size of raw data
    1000 file pointer to raw data (00001000 to 00019FFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

Finally, after fixing the build I was able produce the binary.

> dumpbin /all Vault2Git.exe
Microsoft (R) COFF/PE Dumper Version 14.13.26128.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file Vault2Git.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)
               3 number of sections
        5AAC961D time date stamp Fri Mar 16 21:14:21 2018
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
              22 characteristics
                   Executable
                   Application can handle large (>2GB) addresses

OPTIONAL HEADER VALUES
             10B magic # (PE32)
           48.00 linker version
            2A00 size of code
             800 size of initialized data
               0 size of uninitialized data
            488A entry point (0040488A)
            2000 base of code
            6000 base of data
          400000 image base (00400000 to 00409FFF)
            2000 section alignment
             200 file alignment
            4.00 operating system version
            0.00 image version
            4.00 subsystem version
               0 Win32 version
            A000 size of image
             200 size of headers
               0 checksum
               3 subsystem (Windows CUI)
            8540 DLL characteristics
                   Dynamic base
                   NX compatible
                   No structured exception handler
                   Terminal Server Aware
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
               0 [       0] RVA [size] of Export Directory
            4838 [      4F] RVA [size] of Import Directory
            6000 [     5D0] RVA [size] of Resource Directory
               0 [       0] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
            8000 [       C] RVA [size] of Base Relocation Directory
            4700 [      1C] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Global Pointer Directory
               0 [       0] RVA [size] of Thread Storage Directory
               0 [       0] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
            2000 [       8] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
            2008 [      48] RVA [size] of COM Descriptor Directory
               0 [       0] RVA [size] of Reserved Directory


SECTION HEADER #1
   .text name
    2890 virtual size
    2000 virtual address (00402000 to 0040488F)
    2A00 size of raw data
     200 file pointer to raw data (00000200 to 00002BFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

RAW DATA #1
  00402000: 6C 48 00 00 00 00 00 00 48 00 00 00 02 00 05 00  l
  H......H.......

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    5AAC961D cv           11C 0000471C     291C    Format: RSDS, {6A3D67D9-1665-4534-9B97-E55106582643}, 1, Vault2Git.pdb

  clr Header:

              48 cb
            2.05 runtime version
            2720 [    1F28] RVA [size] of MetaData Directory
               1 flags
                   IL Only
         6000001 entry point token
            4648 [      B8] RVA [size] of Resources Directory
               0 [       0] RVA [size] of StrongNameSignature Directory
               0 [       0] RVA [size] of CodeManagerTable Directory
               0 [       0] RVA [size] of VTableFixups Directory
               0 [       0] RVA [size] of ExportAddressTableJumps Directory
               0 [       0] RVA [size] of ManagedNativeHeader Directory


  Section contains the following imports:

    mscoree.dll
                402000 Import Address Table
                404860 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                    0 _CorExeMain

SECTION HEADER #2
   .rsrc name
     5D0 virtual size
    6000 virtual address (00406000 to 004065CF)
     600 size of raw data
    2C00 file pointer to raw data (00002C00 to 000031FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

RAW DATA #2
  00406000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 
  ................

SECTION HEADER #3
  .reloc name
       C virtual size
    8000 virtual address (00408000 to 0040800B)
     200 size of raw data
    3200 file pointer to raw data (00003200 to 000033FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
42000040 flags
         Initialized Data
         Discardable
         Read Only

RAW DATA #3
  00408000: 00 40 00 00 0C 00 00 00 8C 38 00 00              [email protected]..

BASE RELOCATIONS #3
    4000 RVA,        C SizeOfBlock
     88C  HIGHLOW            00402000
       0  ABS

  Summary

        2000 .reloc
        2000 .rsrc
        4000 .text

References

  1. https://www.roelvanlisdonk.nl/2015/12/17/convert-sourcegear-vault-standard-v3-1-9-to-git-including-all-history/