Revit 매크로 업그레이드

매크로를 업그레이드할 경우 Revit에서 매크로를 올바르게 업데이트하고 작동하기 위해 일부 파일을 관리해야 합니다.

Revit 소프트웨어 개발 키트(SDK)의 변경사항과 다음 매크로 업그레이드 정보를 익혀야 합니다.

응용프로그램 레벨 매크로 업그레이드

  1. 매크로 디렉토리 복사 및 붙여넣기 위치:
    • Windows 7 및 Windows 8: %ProgramData%\Autodesk\Revit\Macros\2026 Release\Revit\AppHookup
  2. .csproj를 찾아 다음과 같이 변경합니다.
    • "<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>"을 "<TargetFramework>net7.0-windows</TargetFramework>"로 변경합니다.
다음은 새 매크로 프로젝트의 예입니다.
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0-windows</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
    <PlatformTarget>x64</PlatformTarget>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
    <Optimize>False</Optimize>
    <DebugSymbols>True</DebugSymbols>
    <DebugType>Portable</DebugType>
    <OutputPath>..\..\Addin\</OutputPath>
    <AssemblyName>MacroTemplate</AssemblyName>
    <BaseInterMediateOutputPath>obj\</BaseInterMediateOutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <InterMediateOutputPath>obj\Debug</InterMediateOutputPath>
    <Deterministic>false</Deterministic>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
    <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="..\..\..\..\..\RevitAPI.dll">
      <Private>False</Private>
    </Reference>
    <Reference Include="..\..\..\..\..\RevitAPIUI.dll">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
    <Exec Command="del $(OutputPath)\*.dll" />
  </Target>
</Project>

문서 레벨 매크로 업그레이드

  1. 문서 레벨 매크로는 Revit 2025에서 지원되지 않습니다. 문서 레벨 매크로를 응용프로그램 레벨 매크로로 수동으로 변환해야 합니다.
  2. 이전 버전의 Revit을 사용하여 문서를 열고 문서 매크로 프로젝트를 응용프로그램 매크로 폴더에 복사합니다.
  3. .csproj 파일을 업데이트합니다.
  4. 파일 이름을 변경합니다. "ThisDocument.cs"를 "ThisApplication.cs"로, "ThisDocument.Designer.cs"를 "ThisApplication.Designer.cs"로 변경합니다.
  5. .cs 파일에서 클래스 이름을 "ThisDocument"에서 "ThisApplication"으로 변경합니다.
  6. ThisApplication.Designer.cs에서 수퍼클래스 이름을 "Autodesk.Revit.UI.Macros.DocumentEntryPoint"에서 "Autodesk.Revit.UI.Macros.ApplicationEntryPoint"로 변경합니다.
주: Revit 2025에서 업그레이드된 매크로는 Revit이 이미 실행 중인 경우 자동으로 로드되지 않습니다. 업그레이드된 매크로를 로드하려면 Revit을 다시 시작해야 합니다.