Select to view content in your preferred language

Migrate 2.9 to 3.0 LayoutProjectItem -- LayoutProjectItem could not be found

609
4
Jump to solution
07-06-2022 01:32 PM
PeteVitt
Occasional Contributor III

Hi - I've migrated project from 2.9 to 3.0 and am using this code in an attempt to get the layout: 

using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Layouts;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Core.CIM;

...

string paneName = activePane.Caption;

LayoutProjectItem layoutProjItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(paneName));

...

Getting error:  type or namespace name 'LayoutProjectItem' could not be found.  

I see an ArcGIS Pro sdk 3.0 code snippet that looks like the code I'm using:

 

LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>()
                           .FirstOrDefault(item => item.Name.Equals("MyLayout"));

https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Layouts#reference-layout-project-items-and-t...

What am I missing? The 'LayoutProjectItem' at 2.0  was in ArcGIS.Desktop.Layouts

Thanks

 

Pete

 

 

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

FYI: that's the content of the ArcGIS.Desktop.Layouts namespace in the Extensions assembly.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic74111.html

 

Double check that you have a good reference to the ArcGIS.Desktop.Layouts assembly in your project.

 

View solution in original post

4 Replies
CharlesMacleod
Esri Regular Contributor

It is still there. U have something else going on.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11105.html 

 

 

0 Kudos
PeteVitt
Occasional Contributor III

I'm only seeing the 5 items in the screenshot for IntelliSense of ArcGIS.Desktop.Layouts.  Does this look wrong?  I converted the visual studio project from 2.9 to 3.0 with the utility.  Guess I'll try making a new project

0 Kudos
CharlesMacleod
Esri Regular Contributor

FYI: that's the content of the ArcGIS.Desktop.Layouts namespace in the Extensions assembly.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic74111.html

 

Double check that you have a good reference to the ArcGIS.Desktop.Layouts assembly in your project.

 

PeteVitt
Occasional Contributor III

that was it -- assembly needed to be added.  Thanks!

0 Kudos