Is it possible to add a layer file (.lyr) to the active map using code in Pro 3? My Pro 2 code does not work in 3.
Did you see the Map, Layout, and Layer Files and Packages section of the 3.0 Migration Guide?
This will work for lyrx files. Lyr file are from ArcGIS Desktop so i am not sure if 3.0 will still load those.
protected override async void OnClick()
{
string url = @"c:\temp\Acme Service Roads.lpkx"; // load layer file
Uri uri = new Uri(url);
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map));
}