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

Error in viewing a web page in browser through the created VS AddIn

$
0
0

I want to View a selected web page in browser through coding of the VS Add-In that I have created. So My code goes as below.

DTE dte;

EnvDTE.UIHierarchy solutionExplorerHier = default(EnvDTE.UIHierarchy);

string currentProject = dte.ActiveDocument.ProjectItem.ContainingProject.UniqueName;
                
string projName = currentProject.Substring(currentProject.LastIndexOf("\\") + 1);

string name = "AfterFixingData\\createdPage_After.aspx";
                string path = System.IO.Path.Combine(projName, name);
                dte.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate();

string solutionName = Path.GetFileNameWithoutExtension(dte.Solution.FullName);
                 dte.ActiveWindow.Object.GetItem(path).Select(vsUISelectionType.vsUISelectionTypeSelect);

dte.ExecuteCommand("File.ViewinBrowser");

but when I try run this code I got this error.

'object' does not contain a definition for 'GetItem' and no extension method 'GetItem' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

Is this the way to do a view in browser? If so please help me to fix this problem. Do I need to add any other References? 

If my code is incorrect, please be kind enough to correct me. It's sort of urgent 


Viewing all articles
Browse latest Browse all 4410

Trending Articles



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