简体   繁体   中英

projectItem does not contain a definition for 'Properties'

I'm currently working in a VSIX project with an IWizard implementation, trying to tweak some properties of an ItemTemplate.

My Wizard class (implementing IWizard) is successfully calling the ProjectItemFinishedGenerating method when debugging the VSIX. However, the only property of the projectItem I can seem to actually access is Name , which gets/sets the file name of the item. This works great. However, I want to be able to set the build action but am unable to access any other properties of the projectItem despite them showing up in Intellisense.

Am I missing some sort of reference? Currently referenced is EnvDTE 8.0.0.0, and Microsoft.VisualStudio.TemplateWizardInterface (and of course the assembly from my template project).

Below is the wizard class (I've only included the one method from IWizard, because I am not using the others).

using System.Collections.Generic;
using Microsoft.VisualStudio.TemplateWizard;
using EnvDTE;

namespace VSIXTestProject
{
    public class TestWizard : IWizard
    {
        // This method is only called for item templates,  
        // not for project templates.  
        public void ProjectItemFinishedGenerating(ProjectItem
            projectItem)
        {
            projectItem.Name = "newFileName.json";

            //projectItem.<anything else> gives the error of:
            //projectItem dies not contain a definition for '<anything else>'...
        }
    }
}

This one was my fault. The VSIX project didn't get saved to the Assets tab in the source.extension.vsixmanifest designer for whatever reason.

After adding the wizard to the Assets tab, I can access the rest of the properties as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM