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

Usage of DTE.ItemsOperation.AddExistingItem

$
0
0

Hello All,

We are using visual studio 2010 environment.

we have created a VS package to create our own project type with the steps mentiond in:

htttp://msdn.microsoft.com/en-us/library/cc512961(vs.100).aspx

 

In the CreateProject method of OurProjectFactory we are using the following code to add solution item.

DTE dte2=(DTE2)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE));

UIHierarchy UIH = dte2.ToolWindows.SolutionExplorer;

UIHierarchyItem UIHItem = UIH.UIHierarchyItems.Item(1);

UIHItem.Select(vsUISelectionType.vsUISelectionTypeSelect);

ProjectItem item = UIHItem.DTE.ItemOperations.AddExistingItem(@"D:\Samples.cs");

UIHItem.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Activate();

The above codes adds a item samples.cs at the solution level under solution Items folder..but when we right click on the solution items folder we get following error message "The operation could not be completed.The parameter is incorrect.".

We have no clue why this occurs.

Please help us if any body is aware what is the problem in this case.

 

Thanks and Regards

Roy


Viewing all articles
Browse latest Browse all 4410


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