Eric Brown - Cal
Eric Brown - Cal

Reputation: 14409

DTE ItemOperations.NewFile(...) for VS2010 Addin

in this code, in my addin that I'm attmepting to wrie for Vs2010

    _applicationObject.ItemOperations.NewFile( "General\\Text File", FileName, Constants.vsViewKindCode );

The first paramter is defined as the virtual location for the file.

http://msdn.microsoft.com/en-us/library/envdte.itemoperations.newfile(v=vs.80).aspx

Is it just a String with the path, starting at the root of my soloution?

If so if I want to put a file in /+".CV", how can i do that?

I read some where to create a file while recoriding a macro, and look at the guts of the macro. that said @"Visual C# Items\Code\Class".

but when I run that is says that template can't be found.

Thanks,

Eric-

Upvotes: 4

Views: 1124

Answers (1)

Terrance
Terrance

Reputation: 11872

I actually used this


DTE.ItemOperations.AddNewItem("General\Text File")

which reformed from what I got from the macro editor and put together this

DTEObj.ItemOperations.AddNewItem(@"Visual C# Items\WPF\User Control (WPF)", filename + ".xaml");

So in your case give this a try

DTEObj.ItemOperations.AddNewItem("General\Text File");

Upvotes: 2

Related Questions