diff --git a/Readme.md b/Readme.md index c7689a1..9748c8d 100644 --- a/Readme.md +++ b/Readme.md @@ -88,7 +88,7 @@ Depending on your workflow, you can either deploy the files locally for immediat #### Local deployment -To copy Revit add-in files to the `%AppData%\Autodesk\Revit\Addins` folder after building a project, you can enable the `DeployRevitAddin` property. +To copy Revit add-in files to the default `%AppData%\Autodesk\Revit\Addins` folder after building a project, you can enable the `DeployRevitAddin` property. Copying files helps attach the debugger to the add-in when Revit starts. This makes it easier to test the application or can be used for local development. @@ -104,6 +104,55 @@ Should only be enabled in projects containing the Revit manifest file (`.addin`) `Clean solution` or `Clean project` commands will delete the deployed files. +#### Local deployment location (ProgramData vs AppData) + +By default, local deployment copies the add-in files to `%AppData%\Autodesk\Revit\Addins\$(RevitVersion)`. + +If you prefer to deploy to `%ProgramData%\Autodesk\Revit\Addins\$(RevitVersion)`, enable the +`DeployToProgramData` property alongside `DeployRevitAddin`: + +```xml + + true + true + +``` + +When `DeployToProgramData` is `false` or not set, the add-in continues to be deployed under `%AppData%`. + +_Default: Disabled_ + +#### Add-in manifest location + +The build targets locate the Revit add-in manifest file (`.addin`) by searching recursively under the project directory. +The manifest is resolved by a fixed file name: `$(AssemblyName).addin`. + +This means the `.addin` file can live in the project root or any subfolder, as long as there is exactly one file named `$(AssemblyName).addin` in the project tree. +If multiple files with this name exist, only one of them will effectively be used during publish and deployment (the last one copied). + +#### Versioned folder for local deployment + +By default, local deployment copies the add-in into a folder named after the assembly under +`%AppData%\Autodesk\Revit\Addins\$(RevitVersion)` (for example, `RevitAddIn`). + +If you want the deployment folder name to include the assembly version (for example, `RevitAddIn_1.2.3`), +enable the `AppendVersion` property. Optionally, you can also define a separator between the name and version +with `VersionDelimiter`: + +```xml + + true + true + _ + +``` + +When `AppendVersion` is enabled and `AssemblyVersion` is defined, the add-in will be deployed into a +versioned folder, and the `.addin` manifest will be updated automatically to point to the versioned path. +If `AppendVersion` is not set (or `AssemblyVersion` is missing), the non-versioned folder name is used as before. + +_Default: Disabled_ + #### Publishing for distribution If your goal is to generate an installer or a bundle, enable the `PublishRevitAddin` property. diff --git a/source/Nice3point.Revit.Build.Tasks/targets/Nice3point.Revit.Publish.targets b/source/Nice3point.Revit.Build.Tasks/targets/Nice3point.Revit.Publish.targets index 9616bc2..7560b7c 100644 --- a/source/Nice3point.Revit.Build.Tasks/targets/Nice3point.Revit.Publish.targets +++ b/source/Nice3point.Revit.Build.Tasks/targets/Nice3point.Revit.Publish.targets @@ -9,23 +9,35 @@ --> - false + $(AppData)\Autodesk\Revit\Addins\$(RevitVersion) + $(ProgramData)\Autodesk\Revit\Addins\$(RevitVersion) + false + $(ProgramDataDeployDir) + $(AppDataDeployDir) + + false true false - + + false + $(AssemblyName)$(VersionDelimiter)$(AssemblyVersion) + $(AssemblyName) + $(DeployDir)\$(AddinDeployFolder) + $(AssemblyName).addin + + Condition="'$(PublishRevitAddin)' == 'true' AND '$(RevitVersion)' != ''"> - + <_ResolvedFileToPublishAlways Include="@(Content)" PublishDirectory="%(Content.PublishDirectory)" Condition="'%(Content.CopyToPublishDirectory)' == 'Always'"/> <_ResolvedFileToPublishPreserveNewest Include="@(Content)" PublishDirectory="%(Content.PublishDirectory)" Condition="'%(Content.CopyToPublishDirectory)' == 'PreserveNewest'"/> - + $(PublishDir)\Revit $(RevitVersion) $(Configuration) addin\ $(RootDir)$(AssemblyName)\ @@ -46,29 +58,46 @@ + Condition="'$(DeployRevitAddin)' == 'true'"> - - - + + + + + + - + - + - + + + + + + + + Condition="'$(DeployRevitAddin)' == 'true'"> - - + + + Condition="'$(PublishRevitAddin)' == 'true'">