Inheritance: ProjectPackage
        public override void Initialize()
        {
            base.Initialize();

            generalPropertyPage = new GeneralPropertyPage();

            customProjectPackage = new CustomProjectPackage();
            ((IVsPackage)customProjectPackage).SetSite(serviceProvider);

            customProjectFactory = new MyCustomProjectFactory(customProjectPackage);

            base.SetMsbuildEngine(customProjectFactory);

            int canCreate;
            if(VSConstants.S_OK == ((IVsProjectFactory)customProjectFactory).CanCreateProject(projectFile, 2, 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, "", "", 2, ref iidProject, out pfCanceled);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MyCustomProjectNode"/> class.
        /// </summary>
        /// <param name="package">Value of the project package for initialize internal package field.</param>
        public MyCustomProjectNode(CustomProjectPackage package)
        {
            this.package = package;

            InitializeImageList();

            this.CanProjectDeleteItems = true;
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyCustomProjectNode"/> class.
        /// </summary>
        /// <param name="package">Value of the project package for initialize internal package field.</param>
        public MyCustomProjectNode(CustomProjectPackage package)
        {
            this.package = package;

            InitializeImageList();

            this.CanProjectDeleteItems = true;
        }
Example #4
0
        public void InitializeTest()
        {
            IVsPackage package = new CustomProjectPackage();

            int expected = VSConstants.S_OK;
            int actual = package.SetSite(serviceProvider);

            Assert.AreEqual(expected, actual, "SetSite did not return VSConstants.S_OK");

            actual = package.SetSite(null);

            Assert.AreEqual(expected, actual, "SetSite(null) did not return VSConstants.S_OK");
        }
Example #5
0
 public void IsIVsPackage()
 {
     CustomProjectPackage package = new CustomProjectPackage();
     Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage");
 }
Example #6
0
 public void ConstructorTest()
 {
     CustomProjectPackage package = new CustomProjectPackage();
     Assert.IsNotNull(package, "Constructor failed");
 }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyCustomProjectNode"/> class.
        /// </summary>
        /// <param name="package">Value of the project package for initialize internal package field.</param>
        public MyCustomProjectNode(CustomProjectPackage package)
        {
            this.package = package;

            InitializeImageList();
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyCustomProjectNode"/> class.
        /// </summary>
        /// <param name="package">Value of the project package for initialize internal package field.</param>
        public MyCustomProjectNode(CustomProjectPackage package)
        {
            this.package = package;

            InitializeImageList();
        }
 /// <summary>
 /// Explicit default constructor.
 /// </summary>
 /// <param name="package">Value of the project package for initialize internal package field.</param>
 public MyCustomProjectFactory(CustomProjectPackage package)
     : base(package)
 {
     this.package = package;
 }
 public override void Initialize()
 {
     base.Initialize();
     customProjectPackage = new CustomProjectPackage();
     ((IVsPackage)customProjectPackage).SetSite(serviceProvider);
 }
Example #11
0
 /// <summary>
 /// Explicit default constructor.
 /// </summary>
 /// <param name="package">Value of the project package for initialize internal package field.</param>
 public MyCustomProjectFactory(CustomProjectPackage package)
     : base(package)
 {
     this.package = package;
 }