Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommunityToolkit.WinUI.Converters 8.1.240821 -nuget does not install its namespace correctly in WinUI3 for windows x64 #506

Open
2 of 4 tasks
RossCoeH opened this issue Sep 16, 2024 · 6 comments

Comments

@RossCoeH
Copy link

Describe the bug

Despite having correct nuget dependencies, the CommunityToolkit.WinUI.Converters namespace is not accessible after build giving this error:

Undefined namespace. The 'using' URI refers to a namespace 'CommunityToolkit.WinUI.Converters' that could not be found.

first error line is created at
xmlns:converters="using:CommunityToolkit.WinUI.Converters"

Build is correct, package dependencies in solution explorer do not show errors. The .csprog file contains

  <ItemGroup>
    <PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240821" />
    <PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.1.240821" />
    <PackageReference Include="CommunityToolkit.WinUI.Triggers" Version="8.1.240821" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" /> />
    <Manifest Include="$(ApplicationManifest)" />
  </ItemGroup>
	<!--
    Add fix for sdk package version as the default new project is built with 10.0.19041.00 but SDK reports as requiring 10.0.19041.38
  -->
	<PropertyGroup>
		<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
		<Nullable>enable</Nullable>
  </PropertyGroup>

To replicate, create a new project, add the nuget packages above and modify mainwindow to include a xaml reference of
xmlns:converters="using:CommunityToolkit.WinUI.Converters" - the last portion of (WinUI.Converters) will not be found in the drop down boxes as you type.

Any suggestions on how to fix?

Regression

No response

Steps to reproduce

To replicate, create a new WinUI Blank App (WinUI3 Packaged) project,
Use .Net 8,
Use target of x64 windows only.
Add the nuget packages above into project either by add, copy into .csproj file
Modify mainwindow.xaml to include a xaml reference of
  xmlns:converters="using:CommunityToolkit.WinUI.Converters"

The undefined namespace error will appear as WinUI.Converters portion cannot be found
The error does not go away on build.

Expected behavior

The namspace "CommunityToolkit.WinUI.Converters" should be availabe after CommunityToolkit.WinUI.Converters is installed with nuget

Screenshots

No response

IDE and version

VS 2022

IDE version

4.8.09032

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.1.240821

Additional context

No response

Help us help you

Yes, but only if others can assist

@Sergio0694 Sergio0694 transferred this issue from CommunityToolkit/dotnet Sep 16, 2024
@michael-hawker
Copy link
Member

Looks like a duplicate of #489 - @RossCoeH please ensure your TFM is updated as per the release notes.

@RossCoeH
Copy link
Author

RossCoeH commented Oct 7, 2024

Sorry for delay - but I have been unable to apply suggested solution of retarget to 10.0.26100.0
My issue is not quite the same. The fix suggested required upgrade to target OS 10.0.26100 causes another set of errors, as only some of the Community Toolkit nuget packages support this, and I cannot get all to compile due to a reference that I cannot debug. Somehow it is degrading me to 10.0.2200.0 because of a conflict -but I cannot find which item is causing this - I suspect headered Controls.

I updated all nuget packages including Microsoft.WindowsAppSDK to latest stable using .Net*.0. Setting target framework to 10.0.2200.0 was not sufficient - object browser shows communityToolkit,converters namespace is not there.

Upgrading target and minimum framework to 10.0.26100.0 gives a conflict as some items are dependent on a previous version, causing conflict. I get:
MSB3277 Found conflicts between different versions of "Microsoft.Windows.SDK.NET" that could not be resolved.
There was a conflict between "Microsoft.Windows.SDK.NET, Version=10.0.22000.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.Windows.SDK.NET, Version=10.0.22621.30, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
"Microsoft.Windows.SDK.NET, Version=10.0.22000.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "Microsoft.Windows.SDK.NET, Version=10.0.22621.30, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.

I am stuck on how to resolve as Visual studio is updated to latest, and all nuget packages are latest stable.

My package references ( all latest) are:
<ItemGroup> <PackageReference Include="CommunityToolkit.Common" Version="8.3.2" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" /> <PackageReference Include="CommunityToolkit.WinUI.Controls.HeaderedControls" Version="8.1.240916" /> <PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916" /> <PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.1.240916" /> <PackageReference Include="CommunityToolkit.WinUI.Triggers" Version="8.1.240916" /> <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" /> <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" /> <PackageReference Include="WinUI.TableView" Version="1.2.0" /> <Manifest Include="$(ApplicationManifest)" /> </ItemGroup>

@Arlodotexe
Copy link
Member

@RossCoeH Did you remember to update the TFM in both the csproj and the publish profile?

@parko65
Copy link

parko65 commented Dec 6, 2024

Update to 10.0.26100.0 worked for me.

@michael-hawker
Copy link
Member

@RossCoeH you can also try the 8.2-preview we published to NuGet as well, this relies on the newer Win2D dependency which fixes the issue of needing a newer TFM (why we have this issue in the first place), so if 8.0 was working for you, 8.2 should work as well.

(Thanks for confirming @parko65.) Ultimately, 8.2 is taking a bit longer to get out than we had planned last when we thought about shipping an 8.1 hotfix to back-port the change, but that's also a bit more involved now that we've diverged so much from our last release.

Ideally, it's hopefully easiest for folks to rely on the 8.2-preview now that it's on NuGet. We should have another update out shortly in preview, and then move to a stable release within the next ~month.

@kg-github
Copy link

@RossCoeH Did you remember to update the TFM in both the csproj and the publish profile?

Where is the publish profile? Updating to target 26100 worked to resolve the Converters issue but I have a similar issue with DockPanel not being found despite CommunityToolkit.WinUI.Controls.Primitives (8.1.240916) being there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants