Info: C#, Visual Studio 2010 RC
How can I add a WCF Web Service Project Item to my Project via code?
I can add a Code Class file no problem with:
string csItemTemplatePath = soln.GetProjectItemTemplate("CodeFile", "CSharp");
try
{
projectItems.AddFromTemplate(csItemTemplatePath, fileName);
}
catch (Exception ex)
{
// This is just testing, don't shoot me
MessageBox.Show(ex.Message);
}
but if I try it with:
string itemTemplatePath = soln.GetProjectItemTemplate("WebWcfService", "CSharp");
I get an exception that it can't be found
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
I got the WebWcfService name from:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Web\1033
I pressume it is something to do with how the Solution looks for it's project items but I can't figure out how to do it.