Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an MXD that I would like to publish to an ArcGIS server using C# ArcObjects (preferably as an MSD). I have been unable to find anything regarding this. Essentially I would like to implement the following ArcPy code in ArcObjects:


Any help would be appreciated! Thanks!

share|improve this question
Where do you set that? I cannot find it. – user2974 May 14 '11 at 8:57

Unfortunately, there's no ArcObjects way to do this. You're going to need to do a mixed C#/Python solution to get what you're aiming for.

share|improve this answer
Thanks for your answer. I seem to have picked the combo all right. No time aware in ArcPy and no publishing in ArcObjects! – eddof13 Feb 10 '11 at 20:37

I was going to suggest using the esriCartoXUI.MapOptimizationAppExtension to convert to an msd, but I don't see any documentation for it. If you figure that part out, I think you can publish the msd by using the AgsServerConnection to get a reference to IServerObjectAdmin3. Then use the methods on it to create a new "configuration".

share|improve this answer
Thanks, looking at that it looks like it will be bit of an ordeal to figure out. For now I think I'm going to call a mini arcpy script directly from .NET like so – eddof13 Feb 10 '11 at 15:41
Yeah that looks much simpler, please post your code when you are done (there's nothing wrong with answering your own question). – Kirk Kuykendall Feb 10 '11 at 16:29
I was able to publish the .NET executable to a toolbox and call the python code directly as shown above. However, my current problem is that I suspect that arcpy.mapping.PublishMSDToServer() contains a bug or some undocumented requirement, as when publishing manually, my MSD works correctly, but publishing through that procedure causes incorrect paths to be created and the published MSD does not work. I'm hoping it is some sort of environment setting rather than a bug, so I'm hoping to get some sort of confirmation from ESRI. – eddof13 Feb 14 '11 at 13:47
I was able to get it working by forcing absolute path names in the mxd when using a geodatabase, or by using the sde as the source instead. – eddof13 Feb 14 '11 at 17:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.