我正在将项目从经典的迁移到 core 3.0.我在ViewModel ICollectionView接口中使用它,但 core 3.0框架无法识别它.
I'm migrating my project from classic to core 3.0. I use in my viewmodel ICollectionView interface and it is not recognized in core 3.0 framework.
我添加了几个nuget软件包以尝试使其正常运行,但是没有运气.
I added several nuget packages to attempt to make it work, but with no luck.
Microsoft声称System.ComponentModel定义了icollectionview( docs.microsoft/zh-CN/dotnet/api/systemponentmodel.icollectionview?view=netcore-3.0 ),但找不到.我还尝试包括Windowsbase,但也找不到.
Microsoft claims System.ComponentModel defines icollectionview (docs.microsoft/en-us/dotnet/api/systemponentmodel.icollectionview?view=netcore-3.0), but it is not found. I also tried to include windowsbase, but it's not found either.
我的环境有问题吗?我错过了什么吗?
Is my environment faulty ? Did I miss something ?
感谢您的帮助.
这是一个可在core3项目下编译的小类:
Here is a small class to compile under a core3 project:
class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); ICollectionView col =new CollectionViewSource().View; col.Filter = null; col.Refresh(); } }
感谢ALFA for Microsoft.Windows.SDK.Contracts在核心上提供ICollectionView接口,但不幸的是,它还不完整:未实现过滤器和刷新.
Thanks to ALFA for Microsoft.Windows.SDK.Contracts which offer an ICollectionView interface on core, but unfortunatly, it is not complete: Filter and refresh are not implemented.
推荐答案您需要从以下位置编辑项目文件 YourProjectName.csproj :
You need to edit your project file YourProjectName.csproj from this:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> </PropertyGroup>对此:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> <UseWPF>true</UseWPF> </PropertyGroup>对我有帮助.
更多推荐
带有.net core 3.0的ICollectionView
发布评论