Skip to content

Projects created using "Create a new extension" have issues on C+PC & .NET 9 #38319

@DHowett

Description

@DHowett

originally filed by @michaeljolley

I think these issues are a mix of having only .NET 9 installed and being on an ARM device, but here are the issues I had to work through to get the project to build:

Package reference to Microsoft.CommandPalette.Extensions

NU1604: Warning As Error: Project dependency Microsoft.CommandPalette.Extensions does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.

Fixed with:

  <PropertyGroup>
	  <NoWarn>NU1604</NoWarn>
  </PropertyGroup>

Within {YourExtensionName}Extension.cs:

CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Image

Fixed with:

#pragma warning disable CS8632
    public object? GetProvider(ProviderType providerType)
#pragma warning restore CS8632 

Needless to say, this is not a great fix. 😁


comment from @zadjii-msft

I can't imagine that this is ARM related (if it is, then I think I really don't understand C#)

What version of VS are you using? I'd think that
https://github.com/zadjii-msft/PowerToys/blob/fcc350a73cfe86e94afe4c879826ace29bcff647/src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/TemplateCmdPalExtension.csproj#L15
would have enabled nullable support across the project, and
https://github.com/zadjii-msft/PowerToys/blob/fcc350a73cfe86e94afe4c879826ace29bcff647/src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/Directory.Packages.props#L6
is supposed to set the package version....comment from @michaeljolley

Image

I think on the version, the issue was that it wasn't defined in the project, but I rearranged my project to be able to support multiple extensions (multiple projects), and the Directory.Packages.props was in the root rather than the project folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Author-FeedbackThe original author of the issue/PR needs to come back and respond to somethingProduct-Command PaletteRefers to the Command Palette utilityStatus-No recent activityno activity in the past 5 days when follow up's are needed

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions