ArcGIS Pro 2.4 ClipboardItem ItemInfoValue bug?

441
3
Jump to solution
01-12-2020 05:29 PM
VictorTey
Esri Contributor

Hi, I have a piece of code that worked in 2.3 but failed in 2.4 with the following error, 

Method not found at ArcGIS.Desktop.Core.ClipboardItem.get_ItemInfoValue().

Everything compile fine and I can confirm the following code 

public ItemInfoValue ItemInfoValue { get; set; }

in the ClipboardItem class. My Pro SDK version is 2.4.0.19948.

I check the ArcGIS.Desktop.Core reference -> C:\Program Files\ArcGIS\Pro\bin\Extensions\Core\ArcGIS.Desktop.Core.dll which points to my ArcGIS pro 2.4 install.

I am wondering if I have a mismatch in reference against pro somehow. I have also tried clean/rebuild. Any advise is much appreciated.

if (dropInfo.Data is List<ClipboardItem> clipboardItems)
{
    foreach (var item in clipboardItems)
    {
       var thisItem = item;
       data_path = thisItem.ItemInfoValue.catalogPath;//thisItem.CatalogPath;
   
     }

}

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

Hi Victor

The 2.3 code should successfully compile and execute with 2.4. Can you check in your add-in project's solution explorer for the following:

 

* In your add-in's solution explorer, right click on ESRI.ArcGIS.ItemIndex (listed under the References node.)

* In the Properties window that shows up, check if the CopyLocal attribute for this dll is set to True. It needs be False. If it is True, change this to be False. Compile and run your add-in and check if the error goes away.

Thanks

Uma

View solution in original post

3 Replies
by Anonymous User
Not applicable

Hi Victor,

2.3 and 2.4 have different code base. You need to call differently.

ArcGIS.Desktop.Core dll is straight referencing from the ArcGIS pro installation directory. 

So from your addin, it is better check the version and call the code accordingly.

Below is the sample code for you.

string version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();

if(version.StartsWith("2.3")){

   pathVariable = clipboardItem.CatalogPath;

}

else if(version.StartsWith("2.4")){

   pathVariable = clipboardItem.ItemInfoValue.catalogPath;

}

UmaHarano
Esri Regular Contributor

Hi Victor

The 2.3 code should successfully compile and execute with 2.4. Can you check in your add-in project's solution explorer for the following:

 

* In your add-in's solution explorer, right click on ESRI.ArcGIS.ItemIndex (listed under the References node.)

* In the Properties window that shows up, check if the CopyLocal attribute for this dll is set to True. It needs be False. If it is True, change this to be False. Compile and run your add-in and check if the error goes away.

Thanks

Uma

VictorTey
Esri Contributor

Thank you  you  are spot on.

0 Kudos