Hi all,
 
Here's below the possible solution i've made for the problem mentioned in my previously sent question (http://www.mail-archive.com/nant-users%40lists.sourceforge.net/msg03839.html) :
 
I have a nant build file with a couple of targets. One of them needs the certain VSS project work folder. Sure, i can define this folder in one of the nant project properties, i.e. to make it hard coded. But i don't want to get it in that way. Instead, i want to get the work folder from the VSS project itself. The VSS project is the IVSSItem object of the SourceSafeTypeLib library. Its work folder is stored in the LocalSpec properties of the IVSSItem object.
 
I've added the following task to the NantContrib:
 
using System;
using System.Collections;
using SourceSafeTypeLib;
using NAnt.Core;
using NAnt.Core.Types;
using NAnt.Core.Attributes;
 
namespace NAnt.Contrib.Tasks.SourceSafe {
    [TaskName("workfold")]
    public sealed class GetWorkFolder : BaseTask
    {
 protected override void ExecuteTask()
 {
  Open();
 
  PropertyDictionary pd = Project.Properties;
  pd.Add("work_fold","initial");
  pd.SetValue("work_fold",Item.LocalSpec.ToString());
 }
    }
}
Then in my nant project i call the workfold task in the get_work_fold target and get the certain VSS project work folder in the work_fold nant project property:
 
<?xml version="1.0"?>
 
<project name="test" default="build">
 
 <property name="vss_dbpath" value="C:\Program Files\Microsoft Visual Studio\Common\VSS\srcsafe.ini"/>
 <property name="test_project" value="vss_test"/>
 <property name="basename" value="test.vbg"/>

 <target name="get_work_fold">
  <loadtasks assembly="${nant.dir}\NAnt.Contrib.Tasks.dll"/>
  <workfold dbpath="${vss_dbpath}" path="$/${vss_project}" user=""/>
 </target>
 
 <target name="build" depends="get_work_fold">
  <loadtasks assembly="${nant.dir}\NAnt.Contrib.Tasks.dll"/>
  <vb6
   project="${work_fold}\${basename}"
   outdir="${work_fold}\test_build"
  />
 </target>               
 
</project>
 
Is there another simplest solution?
 
Any comments about this solution are welcome and will be very much appreciated.
 
Thank you.
 
Regards,
AlexK
 

Reply via email to