At your clinic, you may have different installations of ARIA (and Eclipse) for different systems. For example, you may be running Eclipse v. 13.6 in your clinical system but v. 15.1 in your development system. This also means that you have two different versions of ESAPI.
In many cases, the code you wrote for one version of ESAPI is compatible with the other version. The only thing you need to do to make your scripts work in either system is to recompile it with the correct version. But this can be time-consuming because you need to change all the ESAPI references in your project(s) with the correct ones.
A more convenient solution is to use different build configurations in Visual Studio for the different systems you're targeting. By default, you already have two build configurations (Debug and Release). These may reference ESAPI 13.6. You can then create additional build configurations—call them Debug-15.1 and Release-15.1—that reference ESAPI 15.1.
With these build configurations in place, you'll be able to flip back and forth between ESAPI 13.6 and 15.1 and compile your scripts with the correct version. Of course, the computer you're using to compile your code needs to have the correct version installed. Or, you may have both assembly versions in a shared location that any development computer can access.
To begin, create a new build configuration:
In Visual Studio, open your solution.
Click on the Build menu, then on Configuration Manager.
Under "Active solution configurations," select <New...>.
As an example, name it Debug-15.1, and select Debug under the "Copy settings from option." The "Create new project configurations" checkbox should be checked.
Save your solution and close it.
Run your favorite text editor and open the project file of your solution that references ESAPI (you may have more than one, so do the following with each). A project file has the extension .csproj and it's typically located in the directory of the corresponding project. Find the part where the ESAPI assemblies are referenced. It should look something like the following:
<ItemGroup>
<!-- Some items here -->;
<Reference Include="VMS.TPS.Common.Model.API">
<HintPath>C:\Program Files (x86)\Varian\Vision\13.6\Bin64\esapi\VMS.TPS.Common.Model.API.dll</HintPath>
</Reference>
<Reference Include="VMS.TPS.Common.Model.API">
<HintPath>C:\Program Files (x86)\Varian\Vision\13.6\Bin64\esapi\VMS.TPS.Common.Model.Types.dll</HintPath>
</Reference>
<!-- More items here -->
</ItemGroup>
Notice how there may be more items above or below the Reference items pertaining to ESAPI. These other items may be more references or other kinds of items.
Move the ESAPI references out of the ItemGroup into a new ItemGroup just below the first one. Then, add a condition attribute (shown below) to specify the Debug build configuration. Copy and paste this new ItemGroup below the previous one, and change its condition attribute to specify the Debug-15.1 build configuration. Change the ESAPI paths to the correct versions, as shown below:
<ItemGroup>
<!-- Some items here -->
<!-- More items here -->
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<Reference Include="VMS.TPS.Common.Model.API">
<HintPath>C:\Program Files (x86)\Varian\Vision\13.6\Bin64\esapi\VMS.TPS.Common.Model.API.dll</HintPath>
</Reference>
<Reference Include="VMS.TPS.Common.Model.API">
<HintPath>C:\Program Files (x86)\Varian\Vision\13.6\Bin64\esapi\VMS.TPS.Common.Model.Types.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Debug-15.1'">
<Reference Include="VMS.TPS.Common.Model.API">
<HintPath>C:\Program Files (x86)\Varian\RTM\15.1\esapi\API\VMS.TPS.Common.Model.API.dll</HintPath>
</Reference>
<Reference Include="VMS.TPS.Common.Model.API">
<HintPath>C:\Program Files (x86)\Varian\RTM\15.1\esapi\API\VMS.TPS.Common.Model.Types.dll</HintPath>
</Reference>
</ItemGroup>
Notice that the original ItemGroup does not have the ESAPI references anymore. There are now two new ItemGroups, each one specifying the build configuration they apply to. When the build configuration is Debug, the project will use the 13.6 assemblies. When the the build configuration is Debug-15.1, the project will use the 15.1 assemblies. (The paths shown here may not be the actual paths for your system, so verify the locations of your ESAPI assemblies.)
If you open your solution in Visual Studio, you'll see your build configurations to the left of the Start button in the toolbar (see the figure below). If you're working on a 13.6 system, choose the Debug configuration. If you're on a 15.1 system, choose the Debug-15.1 configuration. When you build your solution, the correct ESAPI assemblies will be referenced.
(Image to be added.)
You can go through the same steps above to create a Release-15.1 configuration. Make sure that this build configuration is made as a copy of the default Release configuration.
Commentaires