我做了一个netstandard类库.我的目标是netstandard 1.6.我的csproj就像:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我有一个WPF项目,我参考了这个dll.我可以在c#中使用netstandard dll的类.我也可以在xaml中使用它们.我甚至对他们有所了解.但是xaml设计师说,我的xaml无效.我可以编译解决方案,我可以运行应用程序.在运行时一切正常.但设计师无法使用它.
Person类看起来像:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
namespace DS.Publications.Common
{
[DataContract(Namespace = Constants.NamespaceConstants.DataContractNamespace)]
public class Person : INotifyPropertyChanged
{
private string _Title = string.Empty;
[DataMember]
public string Title { get { return _Title; } set { Set(ref _Title, value); } } …Run Code Online (Sandbox Code Playgroud)