AnsweredAssumed Answered

PackageAction seems to have no effect when building Add-In

Question asked by ben.reschke on Mar 18, 2019
Latest reply on Jul 7, 2019 by cmacleod-esristaff

I have created a C# project for a ArcGIS Pro 2.3 Add-In. I have ArcGIS Pro 2.3 installed as well as the ArcGIS Pro 2.3 SDK.


In the .csproj file I have changed the value of PackageAction from 'BuildDefault' to 'BuildZipPostProcess' and then again to 'BuildNoPostProcess' and reloaded the entire VS Solution after each change. But neither seem to stop the .esriAddinX file from being created and then placed in %UserProfile%\ArcGIS\AddIns\ArcGISPro\{GUID}\


If I leave PackageAction as 'BuildNoPostProcess' and then rename the Registry Key HKLM\SOFTWARE\ESRI to something else then the .esriAddinX file is no longer copied to the %UserProfile% directory but .esriAddinX file is still created in the Visual Studio solutions $(OutDir) directory. According to the comments provided by the template, this PackageAction should not have done anything??


Here is the Build Output:


5> MyDataSet.Plugin -> ...\Release\MyDataSet.Plugin.dll
5> ZipIntermediatePath Name: obj\Release\temp_archive\...
5> IntermediateOutputPath Name: obj\Release\...
5> CleanFile Name: MyDataSet.Plugin.csproj.FileListAbsolute.txt...
5> ProjectDir Name: ...\ArcGISPro\ArcGISPro.Plugin\...
5> AssemblyName Name: MyDataSet.Plugin...
5> TargetFileName Name: MyDataSet.Plugin.dll...
5> RootNamespace: MyDataSet.Plugin...
5> TargetFolder Name: ...\Release\...
5> PackageType Name: Addin...
5> Install dir:
5> ...
5> ...
5> ConvertToRelativePath Task, TargetDir: ...\Release\
5> Deploying Addin...
5> ArcGISFolder Name: ...
5> Unable to execute RegisterAddIn.exe. ArcGIS Pro is not installed.
========== Build: 5 succeeded, 0 failed, 71 up-to-date, 0 skipped ==========


It still wants to run everything all the way up to registering the AddIn with a installation of ArcGIS Pro.


This out is the same regardless of what PackageAction I have set in the .csproj file. And if the Registry Key for ESRI is named correctly, it will package the .esriAddinX file and copy it to the %UserProfile% AddIn discovery directory.


Here is the relevant section of my .csproj file for the above output:


<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
PackageAction can be:
BuildDefault: ArcGIS Pro is required. An esriAddinX package is created and copied to ArcGIS Pro add-in folder.
BuildZipPostProcess: ArcGIS Pro install is NOT required to build the add-in. An esriAddinX package is created in your output folder.
BuildNoPostProcess: ArcGIS Pro install is NOT required to build the add-in. An esriAddinX package is NOT created.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<UsingTask AssemblyFile="$(AGProInstallDir)bin\proapp-sdk-MSBuild.dll" TaskName="proapp_sdk_MSBuild.PackageAddIn" />
<UsingTask AssemblyFile="$(AGProInstallDir)bin\proapp-sdk-MSBuild.dll" TaskName="proapp_sdk_MSBuild.CleanAddIn" />
<UsingTask AssemblyFile="$(AGProInstallDir)bin\proapp-sdk-MSBuild.dll" TaskName="proapp_sdk_MSBuild.ConvertToRelativePath" />
<Import Project="$(AGProInstallDir)bin\Esri.ProApp.SDK.Desktop.targets" Condition="Exists('$(AGProInstallDir)bin\Esri.ProApp.SDK.Desktop.targets')" />


So what am I doing wrong?