ProConcepts 3.0 Migration Guide,Pro2.8升级ArcGIS Pro3.0
来自:https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-3.0-Migration-Guide
ArcGISPro 3.0 is a breaking change release. The 3.0 API breaking changes and migration procedure for 2.x add-ins, configurations, core host applications, and plugin datasource extensions are discussed within this document.
Language: C#
Subject: Framework
Contributor: ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization: Esri, http://www.esri.com
Date: 6/17/2022
ArcGIS Pro: 3.0
Visual Studio: 2022
In this topic
- Overview
- Migrating to Pro 3.0
- Breaking Changes By Assembly
- ArcGIS.Core.dll
- ArcGIS.CoreHost.dll
- ArcGIS.Desktop.Catalog.dll
- ArcGIS.Desktop.Core.dll
- ArcGIS.Desktop.DataReviewer.dll
- ArcGIS.Desktop.Editing.dll
- ArcGIS.Desktop.Extensions.dll
- ArcGIS.Desktop.Framework.dll
- ArcGIS.Desktop.Geoprocessing.dll
- Esri.ArcGIS.ItemIndex.dll
- ArcGIS.Desktop.Layout.dll
- ArcGIS.Desktop.Mapping.dll
- ArcGIS.Desktop.TaskAssistant.dll
- ArcGIS.Desktop.Workflow.dll
- CIM Persistence
- Additional Migration Notes
Overview
At 3.0, ArcGIS Pro has moved to .NET 6, Microsoft's latest version of .NET (formerly known as ".NET Core") with Long Term Support, LTS. This is a breaking release change meaning that:
- Addins, configurations, plugin datasources, and core host applications compiled on version 2.x of Pro will not work with Pro 3.0
- The public APIs (of Pro) are subject to change
- The major version increment of Pro is changing from 2.x to 3.0.
Pro Document Version Change
At ArcGIS Pro 3.0, the document version of ArcGIS Pro Projects, project templates, packages, layer and map files (.aprx, .ppkx, .aptx, .pagx, .lyrx, .mapx, etc.) has also changed to 3.0. Any project, template, package, etc. created or saved using ArcGIS Pro 3.0 will be saved with a document version of 3.0. This includes a file, package, template, etc. with a document version of 2.x opened in 3.0. Consult the ArcGIS Pro migration help topic in the Pro help for more detailed information.
Note: Map, Layout, and Layer (.mapx, .pagx, .lyrx) and packages (.mpkx, .lpkx), created at 2.x, can be read by public API at 3.0 with no changes. This is covered in the Map, Layout, and Layer Files and Packages section of this document.
Forwards Compatibility
Addins, configurations, and plugin datasources are forwards compatible across minor releases of Pro only. They are not forwards compatible across major releases. As the move from 2.9 to 3.0 is a major release, addins, configurations, plugin datasources, and core host applications compiled against a 2.x version of Pro must be migrated to Pro 3.0 and recompiled.
The migration procedure is detailed below in the Migrating to Pro 3.0 section.
Registering addins
Attempting to register a 2.x addin, configuration, or plugin datasource against Pro 3.0 will fail though it will still be deployed. RegisterAddin.exe will pop-up a warning message alerting you that the add-in or configuration you are attempting to install won't be loaded because it is incompatible with the current version of Pro.
Proceeding with the installation deploys the archive file to the respective folder but when Pro starts it will not be loaded.
Add-in and Configuration Does Not Load
In many cases you may already have add-ins or configurations installed on your machine from a 2.x release when you upgrade Pro to 3.0. When you run Pro, previously installed addins, configurations, and plugin datasources from a 2.x release will not load in Pro 3.0. Any add-in that is incompatible with the current release will be shown as disabled on the Add-in Manager backstage tab of Pro. The add-ins must be migrated to Pro 3.0 before they can be loaded. The same is true for configurations, plugin datasources, and core host applications*.
*Core host applications must be migrated but they are not loaded by, nor registered with, Pro.
Build Server use of ArcGISSignAddIn.exe
Note: per ProConcepts Advanced Topics, manual configuration of a build server, configuring a build server to use ArcGISSignAddIn.exe at 2.x (without installing ArcGIS Pro) required that the DADFLib.dll and zlibwap.dlls also be available in the server's Pro bin folder being referenced (for compilation purposes).
At 3.0, to sign the add-in using ArcGISSignAddIn.exe, now copy ArcGISSignAddIn.exe, ArcGISSignAddIn.dll, ArcGISSignAddIn.runtimeconfig.json and DADFLib.dll to your server's Pro bin folder. Refer to the previously mentioned ProConcepts Advanced Topics for more information.
Migrating to Pro 3.0
Any 2.x Addins, configurations, plugin datasources, and core host application must be migrated to Pro 3.0 before they can be run in (or on) the Pro application. The process of migration is the main subject of this document and generally follows a two-step process:
- Addins, configurations, plugin datasources, and core host applications must be converted from .NET Framework 4.x to .NET 6
- Addins, configurations, plugin datasources, and core host applications must be recompiled against 3.0 and resulting compilation errors (from API breaking changes) must be fixed.
For the remainder of this document the 4 extensibility patterns of Pro - Addins, configurations, plugin datasources, and core host applications - will be collectively referred to as "addins" unless there is a particular nuance or idiosyncracy of one of the extensibility patterns that requires it be specifically mentioned for particular attention.
Install Pro and the Pro SDK for 3.0
To migrate your addins at 3.0 following the procedure in this document, it is assumed that you have installed the 3.0 Pro SDK. Minimum requirements for the Pro SDK at 3.0 are Visual Studio 2022 and .NET 6. Consult the ProGuide Installation and Upgrade document for detailed installation instructions and minimum requirements.
Step 1 Conversion
Migration to Pro 3.0 begins by converting your Addins from the .NET Framework to .NET 6. It is perfectly acceptable to migrate your addin to .NET 6 by hand. In this case, simply use the Pro SDK Templates to create a new addin (or configuration, or plugin, or corehost) project and copy over relevant source files, 3rd party dependencies (updated as needed to support .NET), Nuget references, etc. to re-construct a 3.0 version of your 2.x project. This may be desirable if your addin has particular idiosyncracies or special settings that require manual reconfiguring for .NET. Otherwise, use the "Pro Migrate Project" utility which is the focus of the rest of this particular section.
Note: addin developers should make whatever backups or copies of the pre-converted project as they require before running the conversion utility. Run Pro Fix References (from the proapp-sdk-utilities.vsix) to update the assembly paths within your 2.x .csproj/.vbproj before running the migration tool if the addin assembly paths need to be updated (e.g. you copied the 2.x addin from another machine).
To install "Pro Migrate Project", run the "proapp-sdk-migration.vsix" that comes with the Pro SDK at 3.0. This will add the utility to the Visual Studio 2022 project context menu (alongside the other Pro SDK context menu options).
To run the migration utility, open the respective addin, configuration, plugin datasource, or core host application project in Visual Studio 2022. Next, right-click and run the "Pro Migrate Project" option to convert the addin project (whether addin, configuration, plugin datasource, or core host application) to .NET 6. The conversion utility can be used to convert both C# and VB.Net 2.x addin projects.
When the "Pro Migrate Project" conversion utility is run it prompts the user as to whether or not they want to proceed:
Assuming "Yes" is selected, the conversion utility performs the relevant conversion of the addin project to .NET 6. The user should acknowledge the "migration completed successfully" prompt and click "Reload" on the Visual Studio prompt to reload the project. Post conversion:
- The target framework will have been changed to .NET 6.0
- The output addin .csproj or .vbproj will be converted to .NET project format (which is significantly different from the .NET Framework format)
- The project References folder will have been changed to a .NET Dependencies folder
- The
desktopVersion
attribute in the Config.daml will have been changed to 3.0 - For plugins, the
version
attribute will have been changed to 3.0 - For plugins, the
language
attribute will have been changed toCLR:PluginDS
. - Build Action "AddinContent" will have been changed to Build Action "Content" (refer to AddinContent for more information)
- Custom Targets are copied over unchanged except for
<Target Name="AfterBuild" ...>
. It will be changed to<Target Name="SignAddin" ...>
. - Pro SDK Nuget references are updated to the reference the 3.0 Nuget. Refer to ProGuide ArcGIS Pro Extensions Nuget for more information on the 3.0 Pro SDK Nuget.
- Project xaml resource dictionaries will have been changed from Build Action "Resource" to Build Action "Page"
- External links will remain as external links
- 3rd party DLL references are not converted. They must be added back by hand, as needed.*
At the conclusion of the migration, a migration status report (in both an html and txt format) will have been added to the Visual Studio project TOC. Review the migration status report for any outstanding conversion issues the migrate tool identified that need to be resolved by hand. For example, updating the Pro SDK Nuget reference to 3.0.
*Any Addins making use of 3rd party Nuget packages or particular custom or non-Microsoft .NET Framework libraries and dlls in their 2.x Visual Studio projects will have to make whatever changes may be needed to reference appropriate .NET 6 equivalents by hand.
Before and After conversion view of the Visual Studio TOC of a 2.x Addin:
Conversion Notes
Additional notes concerning addin conversion.
Target Framework
The target framework of addin .csproj's and .vbproj's must be changed to .NET 6 from which ever version of .NET Framework it is currently using at 2.x (most likely .NET Framework version 4.8). The Pro Migrate Project utility will automatically change the target framework for you, otherwise it will need to be changed by hand*.
*There are structural differences between a Visual Studio .NET Framework project and a Visual Studio .NET (or ".NET Core") project. It may be that, if you choose not to use the Pro Migrate Project utility, you have to make a new Visual Studio 2022 addin project with the .NET 6 target framework set and then copy the relevant 2.x addin content "over" manually.
Config.daml desktopVersion and Config.xml version Attributes
Addins and configurations created prior to 3.0 will have a desktopVersion
value in their Config.daml of 2.9 or less. Plugin datasources created prior to 3.0 will have a version
attribute on the <Target ...>
element in their Config.xml of 2.9 or less. The conversion utility will change the Config.daml desktopVersion
and Config.xml version
(for plugin datasources) to 3.0, otherwise these changes must be made by hand.
Refer to Pro Concepts Advanced Topics, Add-in Versioning for more information on versioning.
Config.xml Language Attribute
At 3.0, the <AddIn language="CLR4.X.X" ...>
attribute in the Config.xml must be changed to CLR:PluginDS
. The conversion utility will make this change automatically to the Config.xml, otherwise the change must be made by hand.
Config.xml
<!-- before at 2.x -->
<AddIn language="CLR4.7.2" library="AcmePluginDatasource.dll" namespace="AcmePluginDatasource">
<ArcGISPro>
...
<!-- at 3.0 -->
<AddIn language="CLR:PluginDS" library="AcmePluginDatasource.dll" namespace="AcmePluginDatasource">
<ArcGISPro>
...
AddinContent
At 3.0, the custom Visual Studio build action AddinContent is no longer supported. To embed custom content within the addin archive, addins should use the built-in build action Content instead.
The Pro SDK "Pro Migrate Project" tool will automatically convert AddinContent types to Content in the converted .csproj and .vbproj, otherwise the change must be made by hand.
<!-- At 2.x -->
<ItemGroup>
<AddInContent Include="ReadMe.md" />
</ItemGroup>
<!-- At 3.0 -->
<ItemGroup>
<Content Include="ReadMe.md" />
</ItemGroup>
Target "AfterBuild"
If your addin or configuration is using a <Target Name="AfterBuild" ...>
element within your .csproj or .vbproj (i.e. as documented in the ProGuide Digitally Signed Addins and Configrations for 2.x) then that Target element will be changed from: <Target Name="AfterBuild" DependsOnTargets="PackageArcGISContents">
to <Target Name="SignAddIn" AfterTargets="PackageArcGISContents">
. This change is likewise reflected in the previously mentioned ProGuide for 3.x.
All other <Target ...>
elements are copied over unchanged. The contents of all Target elements, to include the above mentioned <Target Name="AfterBuild" ...>
, are also copied over unchanged (eg any <Exec ...>
elements). These may or may not need to be modified by hand depending on the idiosyncracies of the Target content itself relevant to .NET.
For more information on the use of a Target element with MSBuild consult Target Element - MSBuild
Other Custom Content
Any custom .csproj or .vbproj content added as Resource, Content, AddinContent (see above), or None will be migrated into the converted .csproj or .vbproj by the migration tool. The "Copy to Output Directory" setting is also preserved*.
* At the time of writing this document, there is a bug with Visual Studio version 17.0.0 - 17.1.2. Copy to Output Directory always shows "None" in the item properties window. To determine if the Copy to Output Directory is properly set, view the item definition in the .csproj or .vbproj file. It should look similar to the below xml:
<!-- content type None, CopyToOutputDirectory 'Copy Always' -->
<ItemGroup>
<None Include="Content\MS_Word_Doc.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<!-- content type None, CopyToOutputDirectory 'Copy if Newer' -->
<ItemGroup>
<None Include="Content\MS_Word_Doc.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
XAML Resources Marked As Page
With Visual Studio 2019 | 2017 and .NET Framework projects, xaml resources (i.e. 'Resource Dictionaries') are added to a project with a build action of type "Resource". For Visual Studio 2022 and .NET 6, xaml resources must be marked as build action "Page". This includes xaml templates for DAML galleries and combo boxes. Xaml templates still marked as "Resource" in a .NET 6 project will not load and the pack Uri will return null.
When migrating from 2x to 3.0, the migration tool will make the xaml resource build action change for you automatically, however, if converting your addins by hand, ensure that your xaml resources are changed to build action "Page".
When adding a new Resource Dictionary at 3.0 via the Visual Studio 2022 item template, Visual Studio will automatically set the correct build action for you so new xaml resource references do not have to be changed.
3rd Party References and Non-Esri DLLs
The migration tool cannot discern if a given DLL reference is compatible with .NET or not. Therefore all 3rd party references (i.e. non-Esri) are excluded from the converted .csproj/.vbproj. The addin developer should add the relevant references back to the converted project by hand. Developers may also have to similarily add back in Nuget package references for the same reason.
NotUsed Files
In .NET 6 and Visual Studio 2022, all source files in the project folder are automatically included in the build by default. In .NET Framework Visual Studio 2017/2019 projects, source files that are present in the project folder, but are not explicitly referenced in the 2.9 project file, are ignored by the build or "not used". Therefore, if the migration tool finds source files in the project folder that are "not used", it will add a ".NotUsed" extension to ensure they remain excluded from the .NET 6/3.0 build. Refer to MSBuild EnableDefaultItems for more information on enabling or disabling default content.
Copy Local Not Working
Copy Local is not working correctly with Microsoft Visual Studio 2022 versions 17.1.6 or earlier. In ArcGIS Pro, we use a setting of "CopyLocal=No" to prevent ArcGIS Pro assemblies being written out into the adding archive. Essentially, we do not want the Pro assembly references to be written out to the addin assembly cache at runtime. Instead, we want the addin to use the Pro assemblies that the Pro application has already loaded (from the Pro bin folder). Additionally, "CopyLocal=No" drastically reduces the size of the addin archive as the assemblies are not included in it.
To fix this issue, it is recommended that you upgrade your Visual Studio 2022 to 17.2 or better. After upgrading your Visual Studio 2022, “clean” the addin project and ensure that the “obj” folder, within the project, is deleted. Check all Pro assembly reference properties in the .csproj or .vbproj and ensure that CopyLocal is set to No. Rebuild the project.
If you remain on 17.1.6 or less, the migration tool will "fix" the copy local behavior for assembly references already in the addin project being migrated. However, if you do add additional assembly references - including non-Esri references - to the project after running the migration, and CopyLocal=No, then they must be fixed manually (unless you upgrade your Visual Studio 2022 to 17.1.2.
To fix an assembly reference with CopyLocal=No, edit the .csproj/.vbproj entry for the relevant assembly|assemblies and add a <Private>False</Private>
to the entry to enforce the CopyLocal=No behavior (note: CopyLocal Yes\No is stored as True|False in the project file). <Private>
is the proper documented tag in MSBuild to use to control Copy Local. A <CopyLocal>
tag, if present, will be ignored.
Here are some before and after examples of Assembly References without and then with the fix:
This is the default - no Copy Local specified so the behavior will default to true or "Yes":
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
</Reference>
In this example, the user, via the VS 2022 UI has set "CopyLocal=No" on the UI - note that VS 2022 has added a <CopyLocal>False</CopyLocal>
tag to the assembly reference. This will correctly sync the Visual Studio UI but, unfortunately, will be ignored by MSBuild and the assembly will be copied local anyway. This is the Visual Studio bug - it adds a "CopyLocal" tag instead of a "Private" tag. It should be using a "Private" tag.
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<CopyLocal>False</CopyLocal> <!-- this tag is -ignored- -->
</Reference>
The reference must be fixed by hand to include the missing <Private>False</Private>
tag to disable copy local. "" is the documented tag in MSBuild for controlling copy local behavior:
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<CopyLocal>False</CopyLocal> <!-- this tag is -ignored- -->
<Private>False</Private> <!-- to prevent copy local, this tag is -required- -->
</Reference>
Note that the "CopyLocal" tag can also be deleted if you prefer - though the UI CopyLocal selection will show blank (no option selected).
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<!-- to prevent copy local, this tag is -required- -->
<Private>False</Private> <!-- note: CopyLocal tag has been deleted -->
</Reference>
Step 2 Recompile and Fix API Breaking Changes
Once the addin has been converted, the second step is to compile the addin and fix all compiler errors resulting from the conversion to .NET 6. Breaking changes will generally fall into one of 4 categories:
- Changes related to the switch from .NET Framework 4.x to .NET 6 (minor). You may need to add the Microsoft Windows Compatibility Pack nuget to your project.
- Classes, methods, and properties previously deprecated at a 2.x release are now deleted at 3.0
- Object IDs are now defined as 64 bit (long) in the Pro APIs at 3.0. This "extra width" in the public APIs is to accommodate any present and future changes to 64 bit oids in the geodatabase and underlying databases.
- API Changes related to naming, parameter ordering, etc. to improve consistency, quality, and remove duplicate functionality. This also includes breaking changes related to removal of CIM XML persistence at 3.0.
To fix a compiler error, the old reference (to class, method, property, enum, etc.) must be changed to the new reference. An overview of each of these categories follows.
Note: There may be other changes required, not strictly API (breaking) changes, related to porting custom addin content such as a python toolbox or custom project and application properties for use with 3.0. These considerations are covered in the Additional Migration Notes section of this document.
.NET 6
Breaking changes related to the switch to .NET 6 are relatively minor however there are still some breaking changes that may affect you. For example, 3rd party User Controls or 3rd party libraries that use an API or technology that isn't available in .NET will need to be switched to a .NET equivalent control or library. APIs that were not ported, by Microsoft, to .NET because they relied on Windows-specific technology include the Windows registry and GDI+ (eg System.Drawing
). For a complete list, reference the Microsoft Breaking changes in .NET 6.
Microsoft Windows Compatibility Pack
Microsoft provides the Windows Compatibility Pack Nuget that can be added to your projects to automatically address many of the .NET Framework to .NET breaking change issues. You can read more about the Windows Compatibility Pack here and Microsoft's own migration, or "porting" guide for .NET Framework to .NET here. The Pro SDK samples and snippets at 3.0 also make use of the Windows Compatibility Pack Nuget. Two of the more common Windows APIs that may be in use within your addins that will require the Compatibility Pack are System.Drawing
and Registry access.
Deprecated Types and Members
Deprecated types and members were deleted at 3.0. Use of a deprecated type or member will have shown up as a compiler warning previously in Visual Studio. Code that referenced a deprecated type or member must be changed to use its replacement. All types and members previously marked as [Obsolete] have been deleted. Addins that were referencing deprecated content at 2.x usually get a compiler warning if the classes, methods, or property were marked with the Obsolete attribute in the code base.
Breaking changes in the public API are covered in much more detail in the Breaking Changes By Assembly section.
64-bit Object IDs
To accommodate current and future expansion of the Geodatabase to consume 64-bit object ids, or "oids", the public API has switched "oid" parameter references and return values from Int32 to long. This also includes row and feature counts returned from methods like Selection.GetCount()
topic7637.html. This should be a fairly mechanical change for addin code impacted with this change. For addins that favor the use of var
to implicitly declare variable type there should be no noticeable code change as the compiler will automatically change the implicit type of "var" from int to long. Otherwise, for cases where an oid or "count" variable is explicitly declared as int
, addins should make the appropriate change to declare the relevant variables as long
. Attempting to assign a long into an int value will result in a compiler error similar to Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)
. Addins storing oid values in proprietary and/or custom (non-esri) data stores may also need to change the relevant schemas to accommodate long, rather than int values.
Plugin Datasources
Plugin datasource custom table template classes must derive from ArcGIS.Core.Data.PluginDatastore.PluginTableTemplate
. At 3.0, PluginTableTemplate
also consumes 64-bit object ids. Changes should be made therefore, as
needed, to plugin datasource custom code to accommodate 64 bit oids.
Specifically, PluginTableTemplate.GetNativeRowCount will return long and the oid values returned in the PluginRow Values collection from a Search must also be 64 bit (i.e. long). Object ids passed in to the Search method, via the query filter ObjectIDs property, will also be of type long.
//At 2.x
public override int GetNativeRowCount() {
//your implementation here...
...
}
//3.0 - note the return type
public override long GetNativeRowCount() {
//your implementation here...
...
}
Additional API Breaking Changes
Additional API breaking changes (i.e. breaking changes other than those related to .Net 6, deprecated content, and 64 bit oids) include:
- Name changes or "upper-casing/lower-casing" changes to improve the consistency of the API.
- Consolidation of many of the overloads and functions created over the course of 2.x releases. The same is also true for Events.
- Changes to parameters and return values (e.g. from array to IEnumerable or list)
- In some cases, classes, methods, properties, etc. have been replaced, rather than renamed, to acomodate additional or improved capabilities at 3.0.
- In some cases, classes have changed namespaces to improve consistency.
The main breaking changes are covered in the following Breaking Changes By Assembly section.
There are also changes related to the ArcGIS Pro CIM persistence model changing from xml at 2.x to json at 3.0. Breaking changes related to CIM persistence usage are covered in the CIM Persistence section.
Additional Resources
Beyond the information provided in this migration guide, addin developers may find it useful to consult the Pro SDK Community Samples as well as the Pro Snippets all of which have been converted to 3.0.
The What's New for Developers at 3.0 in the API reference contains the complete listing of all API changes.
Breaking Changes By Assembly
This section provides an overview of the main breaking changes, per assembly, to assist you in 3.0 addin migration. Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Core.dll
CIM
At 3.0, addins should use json as the persistence format. To convert serialized CIM xml previously persisted at 2.x to a 3.0 CIM object instance, addins should use ArcGIS.Core.CIM.XmlUtils.UpgradeAndDeserializeCIMObject(xml)
, topic 75062 which has been added at 3.0.
Breaking changes related to CIM persistence usage are covered in detail in the CIM Persistence section. However, a basic example follows:
//At 2.x - persistence using xml - cimObject.ToXml()
simpleRenderer.ToXml()
//and the derived static CIMObject.FromXml() method
//eg for CIMSimpleRenderer
var simpleRenderer = CIMSimpleRenderer.FromXml(xml_string);
//At 3.0
//addins should use cimObject.ToJson()
simpleRenderer.ToJson();
//and the derived static CIMObject.FromJson() method
//eg for CIMSimpleRenderer
var simpleRenderer = CIMSimpleRenderer.FromJson(json_string);
//use to convert CIM xml previously persisted at 2.x -consult the
//CIM Persistence section for more details
var simpleRenderer = (CIMSimpleRenderer)ArcGIS.Core.CIM.XmlUtils.UpgradeAndDeserializeCIMObject(
simple_renderer_xml_from_2x);
At 3.0, there are changes to the XML persistence model in use with CIMGenericView
and implementations of map pane impersonation using custom map pane view models that derive from TOCMapPaneProviderPane
, topic 16597. Custom map panes and impersonation map panes are peristed as CIMGenericView
, topic 1481, in the .aprx. Consult the Custom CIMGenericView and ViewXML section of this document for the relevant changes.
At 3.0, ArcGIS.Core.CIM.CIMObjectMarker3D
has been removed. Addins should use ArcGIS.Core.CIM.CIMMglTFMarker3D
instead. The GL Transmission Format (.glTF file) is an industry-standard interchange format for the transport of 3D models. You can find more information on .glTF here. Additionally, if you were using the CIMObjectMarker3D.ExportWeb3DObjectResource()
method to export 3D symbols to json format for use with the 3D Esri Javascript format then you should switch to creating web styles (for those markers) instead. More information on publishing 3D symbols with web styles can be found in the online documentation: Share a web style. This blog post may also be useful: How To Publish Web Styles with 3D Symbols.
Data / Geodatabase
To accommodate current and future expansion of the Geodatabase to consume 64-bit object ids, or "oids", the public API has switched "oid" parameter references and return values from Int32 to long. This also includes row and feature counts which are now returned as long also. This was covered in the 64-bit Object IDs section earlier within this document.
At 3.0, the Reconcile and Post API has been enhanced. A Post can now be performed as a separate action from Reconcile in the public API. This affects code that previously used the ReconcileDescription
class and version.Reconcile()
method. Consult ProConcepts Geodatabase for more information.
//At 2.x -
ReconcileDescription reconcileDescription = new ReconcileDescription(parentVersion);
reconcileDescription.ConflictResolutionMethod = ConflictResolutionMethod.Continue; //continue if
reconcileDescription.WithPost = true; //conflicts are found
// Reconcile and post
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileDescription);
ReconcileResult.HasConflicts can be checked as-needed
//At 3.0 use ReconcileOptions
var reconcileOptions = new ReconcileOptions(parentVersion);
reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; //continue if
//conflicts are found
reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; //Default
reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorTargetVersion;//or FavorEditVersion
// Reconcile and post as two separate actions
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions);
if (!reconcileResult.HasConflicts) {
//No conflicts, perform the post
var postOptions = new PostOptions(parentVersion);
//var postOptions = new PostOptions(); for default version
postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;//Default
currentVersion.Post(postOptions);
}
//Reconcile and post as a single action (similar to 2.x)
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions, postOptions);
if (reconcileResult.HasConflicts) {
//TODO resolve conflicts
}
All geodatabase exception classes deriving from ArcGIS.Core.Data.GeodatabaseException
and including ArcGIS.Core.Data.GeodatabaseException
have been moved to a new namespace: ArcGIS.Core.Data.Exceptions for consistency.
//At 2.x
using ArcGIS.Core.Data;
...
try {
...
} catch(GeodatabaseException ge) {
//At 3.0
using ArcGIS.Core.Data;
using ArcGIS.Core.Data.Exceptions
try {
...
} catch(GeodatabaseException ge) {//or use explicit reference
//ArcGIS.Core.Data.Exceptions.GeodatabaseException
Utility Network
The namespace ArcGIS.Core.Data.UtilityNetwork.NetworkDiagrams
has been replaced with ArcGIS.Core.Data.NetworkDiagrams.
Geometry
The geometry and derived geometry classes ToXML()
method has been renamed to ToXml()
(note the change in case). Addins referencing ToXML()
will need to change their code to reference ToXml()
instead. Additionally, SpatialReferenceBuilder.FromXML()
has been renamed to SpatialReferenceBuilder.FromXml()
.
//At 2.x
var xml = geometry.ToXML();
var xml = envelope.ToXML();
var xml = mapPoint.ToXML();
var xml = polygon.ToXML();
var xml = polyline.ToXML();
//At 3.0
var xml = geometry.ToXml();
var xml = envelope.ToXml();
var xml = mapPoint.ToXml();
var xml = polygon.ToXml();
var xml = polyline.ToXml();
ArcGIS.Core.Geometry.GeometryException
and derived geometry exceptions have been moved to a new namespace ArcGIS.Core.Geometry.Exceptions. Please change references to existing geometry exceptions accordingly.
// At 2.x
using ArcGIS.Core.Geometry;
...
try {f
...
} catch(GeometryException ge) {
// At 3.0
using ArcGIS.Core.Geometry;
using ArcGIS.Core.Geometry.Exceptions
try {
...
} catch(GeometryException ge) {//or use explicit reference
//ArcGIS.Core.Data.Exceptions.GeometryException
At 3.0, geometry enums with the prefix esri
have been changed to have the prefix Esri
or have had the esri
prefix eliminated. This also includes the enum values.
enum esriArcOrientation --> enum ArcOrientation also, `esri` value prefix has been removed
enum esriClothoidCreateMethod -->enum ClothoidCreateMethod
enum esriCurveDensifyMethod -->enum CurveDensifyMethod
enum esriPatchType -->enum PatchType
enum esriTextureCompressionType -->enum TextureCompressionType
enum EsriShapeExportFlags --> all value prefixes changed from `esri` to `Esri`
enum EsriShapeImportFlags --> all value prefixes changed from `esri` to `Esri`
Other enum changes:
enum GeometryDimension --> enum GeometryDimensionType
enum JSONExportFlags --> enum JsonExportFlags - all value prefixes changed from `json` to `Json`
enum JSONImportFlags --> enum JsonImportFlags - all value prefixes changed from `json` to `Json`
enum Monotonic --> enum MonotonicType
enum SegmentExtension --> enum SegmentExtensionType
enum WKBExportFlags --> enum WkbExportFlags - all value prefixes changed from `WKB` to `Wkb`
At 3.0, the older generation of geometry and segment builders have been removed. Addins constructing geometries and segments using the older builders will need to switch to using the newer "Ex" equivalents. Starting at 2.5+, the new generation of builders was introduced into the public API. These "newer" builders have the suffix "Ex" added to their name, so PolygonBuilderEx, PolylineBuilderEx, EnvelopeBuilderEx, and so on.
The newer geometry and segment builders remove the requirement for the builder to be created on the MCT*, meaning they can be run on any thread, not just the QueuedTask*. Builder "Ex"s are not IDisposable so 2.x code that scoped the lifetime of an older builder with a using(....)
statement must remove the "using" when dealing with the newer builders. 2.x Addins already consuming the builder "Ex"s need make no changes.
//At 2.x ---> 3.0
class MapPointBuilder --- > class MapPointBuilderEx
class MultipointBuilder --- > class MultipointBuilderEx
class LineBuilder --- > class LineBuilderEx
class EllipticArcBuilder --- > class EllipticArcBuilderEx
class CubicBezierBuilder --- > class CubicBezierBuilderEx
class PolylineBuilder --- > class PolylineBuilderEx
class EnvelopeBuilder --- > class EnvelopeBuilderEx
class PolygonBuilder --- > class PolygonBuilderEx
class GeometryBagBuilder --- > class GeometryBagBuilderEx
class MultipatchBuilder --- > class MultipatchBuilderEx
//class SpatialReferenceBuilder is not replaced
Here is an example of 2.x addin code using the older builders converted to 3.0 code using the builder "Ex" equivalent:
//2.x
QueuedTask.Run(() => {
//Builders at 2.x are IDisposable - can scope lifetime with a "using" block
using (PolylineBuilder polylineBuilder = new PolylineBuilder(polyline)) {
polylineBuilder.ReverseOrientation();
var reversedPolyline = polylineBuilder.ToGeometry();
}
});
QueuedTask.Run(() => {
//Run on the MCT
var circularArc = EllipticArcBuilderEx.CreateEllipticArcSegment(segment1, segment2, maxRadius, hintPoint);
//etc
});
//At 3.0 - no using(...) - Builder "Ex" are not IDisposable
var polylineBuilder = new PolylineBuilderEx(polyline);
polylineBuilder.ReverseOrientation();
var reversedPolyline = polylineBuilder.ToGeometry();
// Most of the BuilderEx convenience methods do not need the MCT.
var circularArc = EllipticArcBuilderEx.CreateCircularArc(
segment1, segment2, maxRadius, hintPoint);
//However, this particular EllipticArcBuilderEx constructor _does_ need the MCT. Please refer
//to the API reference as needed. There are only a handful of such cases
QueuedTask.Run(() => {
var cab = new EllipticArcBuilderEx(segment1, segment2, maxRadius, hintPoint);
var otherCircularArc = cab.ToSegment();
//etc
});
Note: SpatialReferenceBuilder is not replaced with an "Ex" equivalent. Consult ProConcepts: Geometry for more details on the Geometry API.
*There are still a handful of builder Ex methods and constructors that require the MCT. This is limited to the EllipticArcBuilderEx, PolylineBuilderEx and PolygonBuilderEx classes. The remaining thread affinity will be removed over the coming 3.x releases.
Licensing
At 3.0, the LicensingInformation.IsAvailable(licenseCode)
method, deprecated at 2.8, has been removed. Addins should use the LicenseInformation.IsCheckedOut(licenseCode)
method,topic 72618, instead.
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.CoreHost.dll
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.Catalog.dll
At 3.0, the return value from ArcGIS.Desktop.Catalog.OpenItemDialog.Items
has been changed from IEnumerable<Item>
to IList<Item>
.
ArcGIS.Desktop.Catalog.ItemFilters
properties have been camel cased. So, for example:
// At 2.x At 3.0
ItemFilters.annotation => ItemFilters.Annotation
ItemFilters.cad=> ItemFilters.Cad
ItemFilters.composite_addToMap => ItemFilters.Composite_AddToMap
...
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.Core.dll
Cef and use of Cef sharp was deprecated at 2.9. Now, at 3.0, Cef is no longer supported. The method, ProApp.InitializeCef()
has been removed.
The threading restrictions forArcGISPortal
methods have changed:
ArcGIS.Desktop.Core.ArcGISPortal.SignIn()
, topic 14680, has changed. Unless the caller is within the OnApplicationInitializing callback of a Configuration, SignIn()
must be invoked on the QueuedTask. This thread restriction was not enforced at 2.x.
ArcGIS.Desktop.Core.ArcGISPortal.SignOut()
, topic 14682, has changed. Unless the caller is within the OnApplicationInitializing callback of a Configuration, SignOut()
must be invoked on the QueuedTask. This thread restriction was not enforced at 2.x.
ArcGIS.Desktop.Core.ArcGISPortal.GetSignOnUsername()
, topic 14676, has changed. Unless the caller is within the OnApplicationInitializing callback of a Configuration, GetSignOnUsername()
must be invoked on the QueuedTask. This thread restriction was not enforced at 2.x.
ArcGIS.Desktop.Core.ArcGISPortal.GetToken()
, topic 14677, has changed. Unless the caller is within the OnApplicationInitializing callback of a Configuration, GetToken()
must be invoked on the QueuedTask. This thread restriction was not enforced at 2.x.
Refer to ArcGIS.Desktop.Mapping.dll for changes to IMappableItem
and IMappableItemEx
relevant for custom item implementations at 3.0.
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.DataReviewer.dll
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.Editing.dll
At 3.0, the derived template class ArcGIS.Desktop.Editing.Templates.EditingFeatureTemplate
(deriving from ArcGIS.Desktop.Editing.Templates.EditingTemplate
, topic 9918) has been changed to ArcGIS.Desktop.Editing.Templates.EditingRowTemplate
, topic 76314. This is to accommodate the support for templates on standalone tables introduced with 2.9. Edit operation overloads that consumed the underlying CIM definition, CIMEditingTemplate
, topic 1174 for the EditingFeatureTemplate class have also changed. The majority of changes are name, spelling, and case changes to improve consistency. This includes the editing template extension methods available on the ArcGIS.Core.CIM.CIMExtensions class within the editing assembly. At 2.x, these methods were available via the ArcGIS.Core.CIM.EditingTemplateCIMExtensions
class.
Addins using CIMFeatureTemplate
, derived from CIMEditingTemplate at 2.x should change their references to CIMRowTemplate
, topic 74946 at 3.0.
Examples follow:
using ArcGIS.Desktop.Editing.Templates;
...
// retrieve the CIM edit template definition - CIMEditingTemplate
var template = mapTool.CurrentTemplate;
var templateDef = template.GetDefinition();
//Property and extension method name changes
//At 2.x
templateDef.ToolProgID = toolContentGUID;
var toolIds = cimEditTemplate.GetExcludedToolDamlIds().ToList();
cimEditTemplate.SetExcludedToolDamlIds(toolIds.ToArray());
cimEditTemplate.AllowToolDamlID("esri_editing_SketchLineTool");
//get a template definition the feature layer
var resTemplate = featLayer.GetTemplate("Residential");
var resTempDef = resTemplate.GetDefinition() as CIMFeatureTemplate;
//use: var newTemplate = new CIMFeatureTemplate(); to create a new one
//EditOperation.Merge(...)
mergeFeatures.Merge(this.CurrentTemplate as EditingFeatureTemplate, featureLayer,
new List<long>() { 10, 96, 12 });
//At 3.0
templateDef.DefaultToolGUID = toolContentGUID;
var toolIds = cimEditTemplate.GetExcludedToolIDs().ToList();
cimEditTemplate.SetExcludedToolIDs(toolIds.ToArray());
cimEditTemplate.AllowToolID("esri_editing_SketchLineTool");
//get a template definition the feature layer
var resTemplate = featLayer.GetTemplate("Residential");
var resTempDef = resTemplate.GetDefinition() as CIMRowTemplate;
//use: var newTemplate = new CIMRowTemplate(); to create a new one
//EditOperation.Merge(...)
mergeFeatures.Merge(this.CurrentTemplate as EditingRowTemplate, featureLayer,
new List<long>() { 10, 96, 12 });
At 2.x, the ArcGIS.Desktop.Editing.Attributes.Inspector
default constructor has removed the optional bool isFeatureEditing = true
flag. At 3.0, the Inspector will always be instantiated allowing features or rows to be updated.
//at 2.x
var insp = new Inspector(true | false);
//At 3.0
var insp = new Inspector();//isFeatureEditing = true is just assumed.
At 3.0, the EditOperation.Create overloads now return a ArcGIS.Desktp.Editing.RowToken
,topic 19317, instance that can be used to retrieve the ObjectID and GlobalID of the newly created feature (when the edit operation has executed successfully). At 2.x, to retrieve the object id required use of an Action<long> result
parameter. THe action parameter has now been removed at 2.x.
Note: retrieving the newly created feature/row object id is required when chaining edit operations.
//At 2.x
long newFeatureID = -1;
editOp.Create(featLayer, poly, (oid) => newFeatureID = oid);
if (editOp.Execute()) {
//operation executed successfully
WriteToLog($"{featLayer.Name}: new feature: {newFeatureID}");
//At 3.0
long newFeatureID = -1;
var rowToken = editOp.Create(featLayer, poly);
if (editOp.Execute()) {
//operation executed successfully
long newFeatureID = (long)rowToken.ObjectID;
WriteToLog($"{featLayer.Name}: new feature: {newFeatureID}");
At 2.x, multiple EditOperation class methods consumed, as a parameter, an IEnumerable of MapMembers along with a corresponding list of object ids of the form IEnumerable<KeyValuePair<MapMember,List<long>>>
. For example: EditOperation.Split, EditOperation.Move, EditOperation.Rotate, EditOperation.Reshape, EditOperation.Scale, and EditOperation.Delete amongst others. This IEnumerable parameter matched the selection output from MapView selection methods such as MapView.SelectFeatures, and MapView.SelectFeaturesEx. At 3.0, MapView selections are supported by a SelectionSet class rather than by a generic .NET collection. Edit operations that previously consumed the generic .NET collection/IEnumerable at 2.x have been changed to consume the SelectionSet class at 3.0. SelectionSet
related changes are also discussed in the ArcGIS.Desktop.Mapping.dll section.
//At 2.x - construct an enumerable of key value pairs from the mapview selection
var selFeatures = MapView.Active.GetFeatures(intersectPolygon).Select(
k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value));
//pass to edit operation
editOp.Split(selFeatures, ...);
editOp.Move(selFeatures, ...);
editOp.Rotate(selFeatures, origin, ...);
editOp.Reshape(selFeatures, ...);
editOp.Scale(selFeatures, ...);
//At 3.0, MapView will return SelectionSet
var selSet = MapView.Active.GetFeatures(intersectPolygon);
//pass to edit operation
editOp.Split(selSet, ...);
editOp.Move(selSet, ...);
editOp.Rotate(selSet, origin, ...);
editOp.Reshape(selSet, ...);
editOp.Scale(selSet, ...);
At 3.0, the editOperation.IsCancelled
flag has been changed to editOperation.IsCanceled
.
At 3.0, editOperation.Duplicate(...)
is removed. Addins using editOperation.Duplicate at 2.x, should use either a copy + move or a create + move edit operation method combination at 3.0.
var editOp = new EditOperation();
editOp.Name = "Duplicate Features";
//At 2.x
editOp.Duplicate(featureLayer, oid, 500.0, 500.0, 0.0);
//At 3.0, use either of a copy + move or a create + move
//in this example, an inspector is being used to access the feature attributes
//
var insp = new Inspector();
insp.Load(featureLayer, oid);
//make a copy using create + attributes
var rtoken = editOp.Create(featureLayer, insp.ToDictionary(a => a.FieldName, a => a.CurrentValue));
if (editOp.Execute()) {
//do a move - chain to keep the two operations as a single undo
var modifyOp = editOp.CreateChainedOperation();
modifyOp.Modify(featureLayer, (long)rtoken.ObjectID, GeometryEngine.Instance.Move(geom, 500.0, 500.0));
modifyOp.Execute();
}
At 3.0, editOperation.Transform(...)
and editOperation.TransformAffine(...)
have been replaced with an overload of editOperation.Transform(...)
, topic 9562, that consumes a TransformMethod. At 3.0, use the derived type of TransformMethod - either TransformByLinkLayer or TransformByLinkLines - to define the transform parameters. Use transformMethod.TransformType to define the type of transformation to perform (TransformMethodType.Affine
or TransformMethodType.Similarity
).
var editOp = new EditOperation();
editOp.Name = "Transform Features";
//At 2.x
var transformSelection = MapView.Active.GetFeatures(polygon).Select(
k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value));
editOp.Transform(transformSelection, linkLayer);
//Transform just a layer
editOp.Transform(featureLayer, linkLayer);
//Perform an affine transformation
editOp.TransformAffine(featureLayer, linkLayer);
//At 3.0
//Define the transform method
var affine_transform = new TransformByLinkLayer() {
LinkLayer = linkLayer,
TransformType = TransformMethodType.Affine //or TransformMethodType.Similarity
};
//Transform a selected set of features
editOp.Transform(MapView.Active.GetFeatures(polygon), affine_transform);
//Perform an affine transformation
editOp.Transform(featureLayer, affine_transform);
//Execute to execute the operation
//Must be called within QueuedTask.Run
editOp.Execute();
//or use async flavor
//await editOp.ExecuteAsync();
At 2.x, construction tools could use an EmbeddableControl to host a custom configurable UI within the create features pane and template UI. The Embeddable control would implement IEditingCreateToolControl
and IEditingCreateToolMultiple
to host the embeddable control UI on the create features pane and/or the template property dialog UI.
At 3.0, the IEditingCreateToolControl
and IEditingCreateToolMultiple
have been removed. Instead, construction tools that have configurable UIs (implemented within an Embeddable control) should derive from ToolOptionsEmbeddableControl for their embeddable controls and implement the relevant overrides.
\\At 2.x - embeddable controls associated with construction tools
\\implement IEditingCreateToolControl and IEditingCreateToolMultiple to
\\display configurable UIs
internal class CustomToolToolOptionsViewModel : EmbeddableControl,
IEditingCreateToolControl {//most common
...
internal class CustomToolToolOptionsViewModel : EmbeddableControl,
IEditingCreateToolControl, IEditingCreateToolMultiple {//less common - tool supports multiple templates
...
\\At 3.0, derive from ToolOptionsEmbeddableControl, no interfaces needed
internal class CustomToolToolOptionsViewModel : ToolOptionsEmbeddableControl {
//Occurs when a tool options control is initialized
public override void OnInitialize(ToolOptions options, bool hostIsActiveTmplatePane) {
//TODO
base.OnInitialize(options, hostIsActiveTmplatePane);
}
//Occurs when a tool options control is initialized
public override void OnInitialize(IEnumerable<ToolOptions> optionsCollection,
bool hostIsActiveTmplatePane) {
//TODO - handle when the tool options control is initialized
}
//Gets and sets the valid state of the tool options - default is true
public virtual bool IsValid { get; set; } = true;
//Gets and sets the dirty state of the tool options - default is false
public virtual bool IsDirty { get; set; }
//Gets and sets whether the tool options should auto open in the Active Template
//pane when the associated tool is activated - default is false
public virtual bool IsAutoOpen(string toolID) => false;
//Gets the icon to display when the tool options are displayed in the Active Template pane.
public override ImageSource SelectorIcon => ... ;
//Gets a working copy of the ToolOptions
protected internal ToolOptions ToolOptions { get; }
// Called at the end of <see cref="OpenAsync"/>, implementations should obtain and interpret the
//options stored in the current <see cref="ToolOptions"/> using
//protected T GetToolOption<T>(string key, T defaultValue, T differentValue = default(T))
protected override Task LoadFromToolOptions() {
//eg, this tool checks if it has a stored default value for a "Buffer" option
double? buffer = GetToolOption<double?>("Buffer", 25.0, null);
if (buffer.HasValue) {//there is a default
...
}
return Task.CompletedTask;
}
For IEditingCreateToolControl
method implementations at 2.x of:
public virtual bool InitializeForActiveTemplate(ToolOptions options)
public virtual bool AutoOpenActiveTemplatePane(string toolID)
use these ToolOptionsEmbeddableControl
overrides on your Embeddable control:
public override void OnInitialize(IEnumerable<ToolOptions> optionsCollection, bool hostIsActiveTemplatePane)
public override bool IsAutoOpen(string toolID)
In the Config.daml, the embeddable control is registered in the esri_editing_tool_options
category and the daml-id is assigned to the toolOptionsID
attribute in the content tag of the construction tool same as was done at 2.x.
ArcGIS.Desktop.Extensions.dll
At 3.0, the ArcGIS.Desktop.Extensions.Controls.BurgerButton
control has been removed. 2.x addins still referencing the BurgerButton control will need to switch over to ArcGIS.Desktop.Framework.Controls.BurgerButton
. The "Framework" BurgerButton control replaced the original "Extensions" control in the 2.2, 2.3 timeframe.
The BurgerButton control is used within dockpanes for a popup menu. It will be referenced in the dockpane usercontrol xaml most likely. Here is an example:
<!-- change this at 2.x -->
<UserControl x:Class="DockPaneBookmarkAdvanced.BookmarkView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
...
xmlns:extensionsControls="clr-namespace:ArcGIS.Desktop.Extensions.Controls;assembly=ArcGIS.Desktop.Extensions"
... >
<!-- to this at 3.0 -->
<UserControl x:Class="DockPaneBookmarkAdvanced.BookmarkView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
...
xmlns:extensionsControls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
... >
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.Framework.dll
At 3.0, the ArcGIS.Desktop.Framework.Controls.ChromiumWebBrowser
control, which was deprecated at 2.9, has been removed. Addins should use the ArcGIS.Desktop.Framework.Controls.WebViewBrowser
control instead.
At 3.0, the behavior of the application title and name has changed. At 3.0, if a FrameworkApplication.Title
is specified then the application title bar defaults to just showing the title and the name and sub-title are not shown:
//At 2.x, this code would show Name-Title-Subtitle
//At 3.0, only title will show.
var date_time = System.DateTime.Now.ToString("g");
FrameworkApplication.Name = date_time;
FrameworkApplication.SubTitle = "MyMap";
FrameworkApplication.Title = Project.Current.Name;
//At 3.0, title is set to "", title defaults to FrameworkApplication.Name
var date_time = System.DateTime.Now.ToString("g");
FrameworkApplication.Name = date_time;
FrameworkApplication.SubTitle = "MyMap";
FrameworkApplication.Title = "";//no title
//At 3.0 Subtitle is ignored in the bar
var date_time = System.DateTime.Now.ToString("g");
FrameworkApplication.Name = "";//no name
FrameworkApplication.SubTitle = "MyMap";
FrameworkApplication.Title = "";//no title
At 3.0, for Configurations and ConfigurationManager
the new title behavior has ramifications for how the ConfigurationManager.ApplicationName is shown in the title bar. At 2.x, the ConfigurationManager.ApplicationName
could be used to override the title bar text. However, at 3.0, because the title bar only shows the application title (if a title is defined), the configuration ApplicationName is ignored. To show the ApplicationName at 3.0, configurations should implement the new TitleBarText override.
Include the configManager.ApplicationName
as part of the configManager.TitleBarText
property. This is explained in detail in the ProConcepts Configurations, TitleBarText section.
At 3.0, the ArcGIS.Desktop.Framework.Dialogs.BrowseForFolder
for browsing for folders (as opposed to browsing for files) has been removed. Addins should use the windows API and the System.Windows.Forms.FolderBrowserDialog
instead. An example follows:
using System.Windows.Interop;// for WindowInteropHelper
//Get a handle to the Pro app window
var parentWindow = new WindowInteropHelper(
FrameworkApplication.Current.MainWindow).Handle;
//At 2.x
//using ArcGIS.Desktop.Framework.Dialogs;
//
//var browseDialog = new BrowseForFolder();
//var selectedFolder = browseDialog.SelectFolder(
// "Please select an output folder", @"C:\\The\\Initial\\Path", IntPtr.Zero);
//....or, use the Pro application window handle
//var selectedFolder = browseDialog.SelectFolder(
// "Please select an output folder", @"C:\\The\\Initial\\Path", parentWindow);
//At 3.0
using System.Windows.Forms;
...
var parentWindow = new WindowInteropHelper(
FrameworkApplication.Current.MainWindow).Handle;
var browseDialog = new FolderBrowserDialog() {
InitialDirectory = @"C:\\The\\Initial\\Path",
Description = "Please select an output folder",
UseDescriptionForTitle = true
};
var selectedFolder = "";
if (folderBrowserDialog1.ShowDialog(
new WindowWrapper(parentWindow)) == DialogResult.OK) {
selectedFolder = folderBrowserDialog1.SelectedPath;
}
//TODO - use selected folder path
...
// http://stackoverflow.com/questions/315164/how-to-use-a-folderbrowserdialog-from-a-wpf-application
public class WindowWrapper : System.Windows.Forms.IWin32Window {
IntPtr _handle = IntPtr.Zero;
public WindowWrapper(IntPtr handle) {
_handle = handle;
}
IntPtr System.Windows.Forms.IWin32Window.Handle => _handle;
}
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.Geoprocessing.dll
At 3.0, ArcGIS.Desktop.Geoprocessing.HistoryProjectItem
, deprecated at 2.1, has been removed.
Consult What's New in the API reference for the complete list of API changes.
Esri.ArcGIS.ItemIndex.dll
Consult What's New in the API reference for the complete list of API changes.
ArcGIS.Desktop.Layout.dll
At 3.0, LayoutElementFactory
has now been renamed to ElementFactory
, topic 76396.
Also, at 2.x, LayoutElementFactory provided a large number of very coarse-grained macros for GraphicElement
creation (i.e. point, line, polygon, and text graphic elements). These have been consolidated into two, generic, macros: CreateGraphicElement for points, lines, and polygons and CreateTextGraphicElement for creation of text. CreateGraphicElement
and CreateTextGraphicElement
also take a new parameter class at 3.0, ElementInfo, allowing some initial properties of elements to be specified up-front, at the time of element creation.
At 2.x, separate LayoutElementFactory macro overloads were required for use with Layouts, GroupElements, and GraphicsLayer as the different containers. Layout and GroupElement macros had a first argument of type ILayoutElementContainer
and GraphicsLayer had a first argument of type GraphicElementContainer
. At 3.0, ILayoutElementContainer
and GraphicElementContainer
have been replaced by a single container of type IElementContainer
, topic 76912 so there is no need to differentiate between the different containers at 3.0, when using ElementFactory
.
Examples follow:
//At 2.x
QueuedTask.Run(()=> {
//Create point, line, polygon graphic elements - we typically match specific geometries
//with specific macros. Overloads for layout, group element, graphics layer as the container
LayoutElementFactory.Instance.CreateGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateGraphicElement(layout, graphic);
LayoutElementFactory.Instance.CreatePointGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateLineGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreatePolygonGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateBezierCurveGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateCircleGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateEllipseGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateFreehandGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateLassoGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateRectangleGraphicElement(layout, ...);
//At 3.0 use CreateGraphicElement with (optional) ElementInfo. No need for separate
//overloads for layout, group element, graphics layer as the container at 3.x
var container = ....;//Layout, GroupElement, or GraphicsLayer
ElementFactory.Instance.CreateGraphicElement(container, bezPl, lineSym, "New Bezier Curve");
ElementFactory.Instance.CreateGraphicElement(container, linePl, lineSym, "New Freehand");
ElementFactory.Instance.CreateGraphicElement(container, env, polySym, "New Polygon");
//and with ElemInfo...
var elemInfo = new ElementInfo() {
Anchor = Anchor.CenterPoint,
Rotation = 45
};
ElementFactory.Instance.CreateGraphicElement(container, env, polySym, "New Polygon", true, elemInfo);
//Or, instead of a geometry + symbol, use a CIMGraphic
var graphic = new CIMPointGraphic() { ..... };
ElementFactory.Instance.CreateGraphicElement(container, graphic);
//At 2.x - create text graphic elements
LayoutElementFactory.Instance.CreateCurvedTextGraphicElement(container, ...);
LayoutElementFactory.Instance.CreatePointTextGraphicElement(container, ...);
LayoutElementFactory.Instance.CreateCircleParagraphGraphicElement(container, ...);
LayoutElementFactory.Instance.CreatePolygonParagraphGraphicElement(container, ...);
LayoutElementFactory.Instance.CreateEllipseParagraphGraphicElement(container, ...);
LayoutElementFactory.Instance.CreateRectangleParagraphGraphicElement(container, ...);
//At 3.0 - use CreateTextGraphicElement and TextType enum to specify the type of
//text to create
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.SplinedText, bezPl, sym, "Curved Text", "New Splined Text");
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.RectangleParagraph, poly, sym, text, "New Polygon Text");
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.CircleParagraph, polyCir, sym, text, "New Circle Text");
//and with ElementInfo
var elemInfo = new ElementInfo() {
Anchor = Anchor.CenterPoint,
Rotation = 45
};
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.PointText, coord2D.ToMapPoint(), sym, textString, "New Point Text", true, elemInfo);
//At 2.x - create map frame and associated surrounds
LayoutElementFactory.Instance.CreateMapFrame(layout, env, mfMap);
LayoutElementFactory.Instance.CreateLegend(layout, env, mapFrame);
LayoutElementFactory.Instance.CreateScaleBar(layout, center, mapFrame, sbStyleItm);