Need help with VB6 Task

Nov 11, 2008 at 11:53 AM
Hi,
I have the below given proj file in C:\Program Files\MSBuild\ExtensionPack\MyProjects\ Directory on my build server.
There are two problems / questions I need resolved
1. If I place the proj file elsewhere outside the program files directory, what path should TPath have. For example if I need to save hte below given test.proj file at c:\MyCompany\Projecgts\Test.proj.
2. CruiseControl.net gives me this error with the below given proj file
C:\Program Files\MSBuild\ExtensionPack\Samples\test.proj (15,5): error: Non-zero exit code from VB6.exe: 1

What might be the reason for this and how to resolve that.

------------ Contents of Proj File Starts -------------------
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TPath>C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks</TPath>
    <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
  </PropertyGroup>
  <Import Project="$(TPath)"/>
  <ItemGroup>
    <ProjectsToBuild Include="C:\CI\builds\MyCompany\Clients\DM\trunk\project1.vbp">
      <OutDir>c:\MyCompany\Bin\</OutDir>
    </ProjectsToBuild>

  </ItemGroup>
  <Target Name="Default">
      <!-- Build a collection of VB6 projects -->
    <MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(ProjectsToBuild)"/>
  </Target>
</Project>

------------ Contents of Proj File Ends -------------------
Thanks
Indidev
Coordinator
Nov 11, 2008 at 1:30 PM
Hi

1.

<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
  <ItemGroup>
    <ProjectsToBuild Include="C:\CI\builds\MyCompany\Clients\DM\trunk\project1.vbp">
      <OutDir>c:\MyCompany\Bin\</OutDir>
    </ProjectsToBuild>

  </ItemGroup>
  <Target Name="Default">
      <!-- Build a collection of VB6 projects -->
    <MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(ProjectsToBuild)"/>
  </Target>
</Project>

2. Can you make sure that c:\MyCompany\Bin exists. If not, you need to creat it.

Let me know if 2 works for you. I'll update the task to create OutDir if it doesn't exist.

Mike
Nov 12, 2008 at 12:04 AM
Hi Mike,
Thanks a lot for the quick response.

1. I will try this today
2. c:\MyCompany\Bin directory already exists on my machines filesystem. I am also able to successfully compile the VBP file outside of CC.NET.

Look forward to hearing further from you.

Thanks,
IndiDev
Coordinator
Nov 21, 2008 at 2:02 PM
Hi IndiDev, are you having any luck with this task now?

Mike
Jan 14, 2009 at 11:08 AM
Hi Mike,
This project was suddenly put on hold and I have been able to get back to it now.

I have been able to successfully compile my VB6 applications after making the suggested code change.

Thanks a tonne for your help!

Regards,
IndiDev
Coordinator
Jan 14, 2009 at 8:51 PM
That's great.

Mike
Jan 16, 2009 at 5:58 AM
Hi Mike,
Just one more thing. How do I update the version number of the vb6 project so that I may handle the versioning from CC.net itself. Is there a task or an exe already available which could help me do that?

Look forward to hearing from you.

IndiDev
Coordinator
Jan 16, 2009 at 3:42 PM
Version info is contained in the .vbp file (s).

You could use MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace" and pass in the regex's to match with appropriate replacement values.
Jan 19, 2009 at 10:14 AM
Edited Jan 20, 2009 at 5:14 AM
Hi Mike,
I tried to do as you've suggested above. I have been somewhat successful too. Because it does replace the string as requested. However, it adds some invalid characters at the beginning of the file. And I dont think I understand why.
This is the proj file:
*********************************************************************************************
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
  <ItemGroup>
    <ProjectsToBuild Include="C:\CI\builds\MyCompany\Clients\DM\project1.vbp">
      <OutDir>c:\Output\</OutDir>
    </ProjectsToBuild>

  </ItemGroup>
    <ItemGroup>
            <FilesToParse Include="C:\CI\builds\MyCompany\Clients\DM\project1.vbp"/>
        </ItemGroup>
    <Target Name="UpdateVersion">
        <MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace" RegexPattern="MajorVer=[0-9]" Replacement="MajorVer=6" Files="@(FilesToParse)"/>
    </Target>
  <Target Name="Default">
      <!-- Build a collection of VB6 projects -->
      <CallTarget Targets="UpdateVersion" />
    <MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(ProjectsToBuild)"/>
  </Target>
</Project>
*********************************************************************************************

This is how the VBP File gets updated. Please note the special characters on the first line.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation
Reference=*\G{8E5B9433-76D4-42A0-8CC5-69F6A38A9E25}#1.0#0#..\..\..\..\..\..\Company\bin\SolvData.Dll#Company Internal DAL
Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#..\..\..\..\..\..\WINDOWS\system32\scrrun.dll#Microsoft Scripting Runtime
Reference=*\G{EE008642-64A8-11CE-920F-08002B369A33}#2.0#0#..\..\..\..\..\..\WINDOWS\system32\MSRDO20.DLL#Microsoft Remote Data Object 2.0
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=Progress.frm
Module=mainModule; mainModule.bas
Module=VersionCheck; ..\..\Common\VC.bas
Class=clsSolvSys; clsSys.cls
Module=Utility; Utility.bas
IconForm="frmProgressBar"
Startup="Sub Main"
HelpFile=""
Title="DM"
ExeName32="DM.exe"
Path32="..\..\..\..\..\..\Output"
Command32=""
Name="Dm"
HelpContextID="0"
CompatibleMode="0"
MajorVer=6
MinorVer=4
RevisionVer=2
AutoIncrementVer=1
ServerSupportFiles=0
VersionCompanyName="Company Company Pvt Ltd"
VersionLegalTrademarks="2008"
VersionProductName="D M"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1

[vbAdvance]
IsConsole=0
HasStubFile=0
GenerateMap=0
TSAware=0
XPManifest=0
ResBuildName=..\..\Company\Bin\DM.dll
ReplaceIcon=0
SendCommandArgs=0
SymbDbgPref=0
RevisionVersion=2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Look forward to hearing from you if you've come across this before, and a way to resolve this.

Thanks,
Indidev


Coordinator
Jan 19, 2009 at 1:10 PM
Looks like an encoding issue. Try specifying the TextEncoding to use (the auto detect appears to not be working).
Jan 21, 2009 at 3:38 AM
Hi Mike,
I passed TextEncoding="UTF-8" as an additional attribute. But still get the same results.

Is there something else I  must be doing too?

Regards,
IndiDev
Jun 2, 2009 at 10:49 AM

IndiDev, did you find a resolution to this?

I now have the same issue.