PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

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

Open DHowett opened this issue 1 year ago • 2 comments

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.

DHowett avatar Mar 31 '25 15:03 DHowett

@michaeljolley You still seeing this on 0.2?

zadjii-msft avatar May 16 '25 17:05 zadjii-msft

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 5 days. It will be closed if no further activity occurs within 5 days of this comment.