Exemplo n.º 1
0
        /// <summary>
        /// Creates a new project by cloning an existing template project.
        /// </summary>
        /// <returns></returns>
        protected override ProjectNode CreateProject()
        {
            MyCustomProjectNode project = new MyCustomProjectNode(this.package);

            project.SetSite((IOleServiceProvider)((IServiceProvider)this.package).GetService(typeof(IOleServiceProvider)));
            return(project);
        }
        public override void Initialize()
        {
            base.Initialize();
            customProjectPackage = new CustomProjectPackage();
            ((IVsPackage)customProjectPackage).SetSite(serviceProvider);

            customProjectFactory = new MyCustomProjectFactory(customProjectPackage);

            base.SetMsbuildEngine(customProjectFactory);

            int canCreate;

            if(VSConstants.S_OK == ((IVsProjectFactory)customProjectFactory).CanCreateProject(projectFile, (uint)__VSCREATEPROJFLAGS.CPF_OPENFILE, out canCreate))
            {
                PrivateType type = new PrivateType(typeof(MyCustomProjectFactory));
                PrivateObject obj = new PrivateObject(customProjectFactory, type);
                projectNode = (MyCustomProjectNode)obj.Invoke("PreCreateForOuter", new object[] { IntPtr.Zero });

                Guid iidProject = new Guid();
                int pfCanceled;
                projectNode.Load(projectFile, "", "", (uint)__VSCREATEPROJFLAGS.CPF_OPENFILE, ref iidProject, out pfCanceled);
            }
        }
 public void ConstructorTest()
 {
     MyCustomProjectNode customProject = new MyCustomProjectNode(customProjectPackage);
     Assert.IsNotNull(customProject, "Constructor failed");
 }
 /// <summary>
 /// Public constructor.
 /// </summary>
 /// <param name="project">Custom project.</param>
 public OAMyCustomProject(MyCustomProjectNode project)
     : base(project)
 {
 }
 /// <summary>
 /// Creates a new project by cloning an existing template project.
 /// </summary>
 /// <returns></returns>
 protected override ProjectNode CreateProject()
 {
     MyCustomProjectNode project = new MyCustomProjectNode(this.package);
     project.SetSite((IOleServiceProvider)((IServiceProvider)this.package).GetService(typeof(IOleServiceProvider)));
     return project;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Public constructor.
 /// </summary>
 /// <param name="project">Custom project.</param>
 public OAMyCustomProject(MyCustomProjectNode project)
     : base(project)
 {
 }