Results 1 to 5 of 5

Thread: Managing 2009 and 2010 versions of API applications

  1. #1
    Member
    Join Date
    2008-09
    Location
    Atlanta, GA
    Posts
    19
    Login to Give a bone
    0

    Default Managing 2009 and 2010 versions of API applications

    Hi All,

    I have a 2009 version and a 2010 version of my application. Though the core functionality and hence the code base is the same, I still have to maintain 2 separate versions that each works with 2009 Revit and 2010 Revit respectively.

    How are you guys out there handling it? I would like to keep one version with different entry points for different Revit versions, but I haven't been able to accompish it as yet.

    Any pointers would be helpful !

    Prashant

  2. #2
    Member
    Join Date
    2008-08
    Posts
    49
    Login to Give a bone
    0

    Default Re: Managing 2009 and 2010 versions of API applications

    Are you trying to create a single application that will work for both?

    The ribbon versus toolbar is the biggest difference between most of my installers.

    If you are able to put a simple switch statement at any point in the code where it differs then you can get the version on initialization and then have the switch work for as many versions as you want. As long as the core is the same this should be pretty simple.

    I use Visual Studio and have two version in the same solution to keep them separate for another option.

    Really I think it just depends on the case. If you have a finished application that you then upgrade to 2010 and do not plan on changing any of the 2009. I would just keep them separate. If you are writing an application for both of them at the same time, it may be easier to use a switch statement for the version.

    Hope this helps,

    Joel

  3. #3
    100 Club
    Join Date
    2004-02
    Location
    Brookline, MA
    Posts
    186
    Login to Give a bone
    0

    Default Re: Managing 2009 and 2010 versions of API applications

    We've traditionally gone a different route, so long as you can invest an hour or two to set this up - at least if you want to be able to do parallel development.

    Generally, I think you need to do two things to achieve a single codebase that can build against multiple versions of Revit.

    1. You need to Reference the different DLLs for each respective version.
    2. You need to have conditional code for places where the code differs.

    We did this by:

    1. Setting up different Project/Solution configurations (i.e. Release 2009/Debug 2009/Release 2010/Debug 2010).

    2. The tricky part is getting the appropriate DLL referenced for each configuration - you can achieve this by hand editing the CSPROJ file. If you find the References section, it is possible to create multiple entries for each project configuration using the "Condition" statement, i.e.:

    Code:
        <Reference Include="RevitAPI, Version=2009.0.0.0, Culture=neutral, processorArchitecture=x86" Condition=" '$(Configuration)' == 'Release2009' ">
          <HintPath>..\..\..\Libs\2009\RevitAPI.dll</HintPath>
          <Private>False</Private>
        </Reference>
        <Reference Include="RevitAPI, Version=2010.0.0.0, Culture=neutral, processorArchitecture=x86" Condition=" '$(Configuration)' == 'Debug2010' ">
          <HintPath>..\..\..\Libs\2010\RevitAPI.dll</HintPath>
          <Private>False</Private>
        </Reference>
    3. Use conditional compilation directives. In your new project configurations, under the Project Properties, you can add "Define" statements (sort of like "DEBUG" is predefined for the default Debug configuration). We add define statements like "REVIT2010" to the appropriate projects, then use it in the code as:

    Code:
    #ifdef REVIT2009
    
      // do something here that only works in 2009
    
    #else
      // do the "new" way here
    #endif

    Good Luck!

  4. #4
    Member
    Join Date
    2008-09
    Location
    Atlanta, GA
    Posts
    19
    Login to Give a bone
    0

    Default Re: Managing 2009 and 2010 versions of API applications

    Quote Originally Posted by joelkarr View Post
    If you are able to put a simple switch statement at any point in the code where it differs then you can get the version on initialization and then have the switch work for as many versions as you want. As long as the core is the same this should be pretty simple.
    Joel
    Joel, I appreciate your help, however, my biggest issue was getting it to compile with different dlls based on what version I am working with. I had thought of using conditional compilation directives, but the problem of using differnt dlls didn't go away !

    Quote Originally Posted by mmason.65315 View Post

    2. The tricky part is getting the appropriate DLL referenced for each configuration - you can achieve this by hand editing the CSPROJ file. If you find the References section, it is possible to create multiple entries for each project configuration using the "Condition" statement, i.e.:

    Code:
        <Reference Include="RevitAPI, Version=2009.0.0.0, Culture=neutral, processorArchitecture=x86" Condition=" '$(Configuration)' == 'Release2009' ">
          <HintPath>..\..\..\Libs\2009\RevitAPI.dll</HintPath>
          <Private>False</Private>
        </Reference>
        <Reference Include="RevitAPI, Version=2010.0.0.0, Culture=neutral, processorArchitecture=x86" Condition=" '$(Configuration)' == 'Debug2010' ">
          <HintPath>..\..\..\Libs\2010\RevitAPI.dll</HintPath>
          <Private>False</Private>
        </Reference>

    Good Luck!
    Matt, I think this is the missing piece ! Thanks for your help !

    Prashant
    Last edited by ppathak; 2009-10-12 at 06:21 PM.

  5. #5
    All AUGI, all the time
    Join Date
    2006-08
    Posts
    636
    Login to Give a bone
    0

    Default Re: Managing 2009 and 2010 versions of API applications

    looks like there's no entry in CSPROJ file to specify "Start external program" in Debug, right?

    edit: never mind, just figured out it's in CSPROJ.USER file
    Last edited by Ning Zhou; 2013-07-11 at 09:22 AM.

Similar Threads

  1. C3D 2009 ó C3D 2010
    By geocad in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2009-10-22, 04:39 PM
  2. RAC 2010 and 2009
    By michael.montagne in forum Revit Architecture - General
    Replies: 5
    Last Post: 2009-05-27, 10:25 PM
  3. 2009 vs. 2010
    By greg.gebert978266 in forum Revit Architecture - General
    Replies: 55
    Last Post: 2009-05-06, 04:28 AM
  4. Amep 2009 DWG opened in earlier versions
    By fathibaali in forum AMEP General
    Replies: 1
    Last Post: 2009-01-23, 06:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •