Skip to content

open_Document(this string file) is not working in VS 2015 #1

@DinisCruz

Description

@DinisCruz

here is the code that is not working

        public static IVsWindowFrame        open_Document(this string file)
        {
            try
            {
                if (file.fileExists().isFalse())
                    "[open_Document] provided file doesn't exist: {0}".info(file);
                else
                {
                    var package = VisualStudio_2010.Package;
                    var openDoc = package.getService<IVsUIShellOpenDocument>();
                    IVsWindowFrame frame;
                    Microsoft.VisualStudio.OLE.Interop.IServiceProvider serviceProvider;
                    IVsUIHierarchy hierarchy;
                    uint itemId;
                    Guid logicalView = VSConstants.LOGVIEWID_Code;
                    openDoc.OpenDocumentViaProject(file, ref logicalView, out serviceProvider, out hierarchy, out itemId, out frame);
                    if (frame.notNull())
                    {
                        frame.Show();
                        return frame;
                    }
                    "[open_Document] could not get IVsWindowFrame for file: {0}".info(file);
                }
            }
            catch (Exception ex)
            {
                ex.log("[in file.open_Document]");
            }
            return null;
        }

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions