Skip to content

Latest commit

 

History

History
78 lines (57 loc) · 1.91 KB

VS2013_vs_VS2015.md

File metadata and controls

78 lines (57 loc) · 1.91 KB

Differences between Visual Studio 2013 and Visual Studio 2015

Exports

Replace uses of:

    [PartMetadata(ProjectCapabilities.Requires, "…")]

With:

    [AppliesTo("…")]

If you have any class members that are themselves exported, you should add the [AppliesTo] attribute to each of those members as well to match the one that appears on the exported class (if any).

If you have exports that have neither of these attributes, they will be ignored in VS2015. VS2013 allowed you to leave the PartMetadata attribute off and defaulted to allowing that export to modify all CPS based projects. That was an unsafe default so the default in VS2015 is to ignore all exports that are missing the attribute that indicates which types of projects an extension should apply to.

Imports

Imports of IVsHierarchy, IVsProject, or IProjectConfigurationService must be changed from:

    [Import(x)]
    Lazy<T> ImportingProperty { get; set; } 

to:

    [ImportMany(x)]
    OrderPrecedenceImportCollection<T> ImportingPropertyCollection { get; set; }

    Lazy<T> ImportingProperty
    {
        get { return this.ImportingPropertyCollection.First(); }
    } 

For any ImportMany of OrderPrecedenceImportCollection that you introduce, you must add a line to your importing constructor:

    [ImportingConstructor]
    YourExtensionClassName(ConfiguredProject project) 
    {
         this.ImportedExtensions = new OrderPrecedenceImportCollection<T>(
            projectCapabilityCheckProvider: project);
    }

Changes that apply to only certain kinds of exports

IDynamicEnumValuesProvider

Replace this pattern:

    [Export(typeof(IDynamicEnumValuesProvider))]
    [DynamicEnumCategory("…")]

with:

    [ExportDynamicEnumValuesProvider("…")]