Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / November 2005

Tip: Looking for answers? Try searching our database.

VS2003: Could not run the 'C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\CSharpProjectItems\CSharpAddClassWiz.vsz ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phoenix_Always - 20 Nov 2005 10:46 GMT
I get the following error when I try to do an AddFile command from
within my addin:
Could not run the 'C:\Program Files\Microsoft Visual Studio .NET
2003\VC#\CSharpProjectItems\CSharpAddClassWiz.vsz
No Inner Exception -

I know its the code as I have been able to reproduce this on tow
different machines -
Anybody run into this before?
Here is what I'm trying to do :
This plugin prototype is fired after the user has opend a solution that
has a project called 'BakaraProject'
In this project I have a folder called 'Tada' and inside that -
another folder called 'ABCD'

I want to create a cs file using the AddFromTemplate function using the
CSharpAddClassWiz.vsz file

Any help is deeply appreciated - This things is on a deadline :(

Thanks in advance,

Phoenix_Always

ps:

Environment : VS 2003 (I know - I want to move to 2005 :)

Code snippets is as follows :
#region -- snip -- import list ---
    using System;
    using Microsoft.Office.Core;
    using Extensibility;
    using System.Runtime.InteropServices;
    using EnvDTE;
    using VSLangProj;
#endregion
#region -- snip -- exec command ---
public void Exec(string commandName, EnvDTE.vsCommandExecOption
executeOption, ref object varIn, ref object varOut, ref bool handled)
{
            handled = false;
if(executeOption ==
EnvDTE.vsCommandExecOption.vsCommandExecOptionDoDefault)
{
    if(commandName == "AddinFileAdditon.Connect.AddinFileAdditon")
    {
    AddFileToAProject();
    handled = true;
    return;
    }
}
}
#endregion
#region -- snip -- Addfile to a project list ---
        private void AddFileToAProject()
        {
            EnvDTE.Solution s = applicationObject.Solution;
            EnvDTE.Project currentProject= null;
            //This is a kluge - how do I get the project if its NOT the first
one?
            for(int ProjectCount =1;ProjectCount<=s.Count;ProjectCount++)
            {
                currentProject= s.Item(ProjectCount);
                if(currentProject.Name=="BakaraProject")
                {
                    BakaraProject = (VSProject)s.Item(ProjectCount).Object;
                    EnvDTE.ProjectItems BakaraProjectItems =
BakaraProject.Project.ProjectItems;
                    EnvDTE.ProjectItem NewsItem = BakaraProjectItems.Item("Tada");
                    this.ABCD_FolderProjectItem = NewsItem.ProjectItems.Item("ABCD");
                }
            }
            ProjectItem LinkFile =
GetProjectItem(ABCD_FolderProjectItem,"Link_MyOwn.cs");
            if( LinkFile ==null)
            {
                try
                {
                    string pathToTemplate =
System.IO.Path.Combine(this.BakaraProject.TemplatePath,"CSharpAddClassWiz.vsz");
                    LinkFile = ABCD_FolderProjectItem.ProjectItems.AddFromTemplate
                        (pathToTemplate ,"Link_MyOwn.cs");
                    ABCD_FolderProjectItem.ProjectItems.AddFromFile(LinkFile.Name);
                }
                catch(Exception e) {
                    string se = e.ToString();
                    se= string.Empty;
                }
            }
        }
        private VSProject BakaraProject = null;
        private _DTE applicationObject;
        private AddIn addInInstance;
        private EnvDTE.ProjectItem ABCD_FolderProjectItem  = null;
}

#endregion
Phoenix_Always - 20 Nov 2005 11:02 GMT
A quick update:
 I can successfully add a cs file manually using the Project->Add Item
and creating the class. The problem happens
programatcally only. The ProgId is declared just above the class
defintion like so:
[GuidAttribute("9BF24471-1EF0-4B94-BF58-ABDD57F1FC41"),
ProgId("AddinFileAdditon.Connect")]
    public class Connect : Object, Extensibility.IDTExtensibility2,
IDTCommandTarget

Will keep hunting -
Thanks,
Phoenix_Always

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.