Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

ViewKind Parameter Ignored in ProjectItem.Open if ProjectItem is Set to Open With Default External Editor

$
0
0

Hi all,

In my VS2010 extension, I have just encountered a situation which I can find no workaround for. As always, I went to Carlos Quintero's MZ-Tools first to see if I could find an answer. In this excellent article of his (http://www.mztools.com/articles/2007/mz2007027.aspx), he discusses how to get "the ProjectItem in the desired view using ProjectItem.Open(viewKind), which returns an EnvDTE.Window object."

This is the behavior I have experienced until I noticed that if a user selects "Open With..." and sets a default external program to open a given item with, I can no longer programmatically open the item in the text editor (this is required functionality for my extension, since I am not setting the Window to visible, anyway). The screenshot below illustrates my point, even though I am working with my own custom extensions.

Open With External Default Application

In this case, calling ProjectItem.Open with every available ViewKind value will cause Program.cs to open in Notepad rather than the text editor. The Window returned from the Open call is always null in this case.

Is there any way I can force an item to open in the text editor, regardless what its default program/viewer is? Thanks for your help,

-Mike


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>