Tag: 便携式类库

XML命名空间clr-namespace:XXX中不存在标记“ViewModelLocator”

我尝试了许多其他解决方案但没有任何成功。 我有一个名为ViewModelLocator的类,它位于我的可移植类库中。 它有一个名为ViewModels的属性,它的类型为Dictionay 然后我有一个引用可移植类库的Windows Phone 8项目。 我在WP8 app.xaml中添加了以下内容: 当我在标签上按F12时,它会导航到我的pcl中的正确类和/或属性。 这表明VS知道对象,但是当我尝试构建时,我收到以下错误: XML命名空间’clr-namespace中不存在标记’ViewModelLocator’:Foo.Core.Portable.ViewModel; assembly = Foo.Core.Portable’。 XML命名空间’clr-namespace中不存在标记’SampleViewModel’:Foo.Core.Portable.ViewModel; assembly = Foo.Core.Portable’。 有人可以提供一些帮助吗? [更新]我在我的pcl项目中引用了mvvm light的pcl版本。 这就是ViewModelLocator类的样子: public class ViewModelLocator { public dynamic this[string viewModelName] { get { if (this.ViewModels.ContainsKey(viewModelName)) { return this.ViewModels[viewModelName]; } else { return null; } } } public Dictionary ViewModels { get; set; } public ViewModelLocator() […]

Windows Phone 8中的PCLStorage

我正在使用PCLStorage进行我正在进行的Win8 / Wp8项目。 我在PCL中使用它,并在我的Win8,Wp8和PCL项目中引用它。 在Win8中,一切都很好用。 但是,在Wp8中,一旦我使用PCLStorage访问PCL进行存储,当我调用FileSystem.Current;时,我得到一个NotImpmlementedException FileSystem.Current; “此function未在此程序集的可移植版本中实现。您应该从主应用程序项目中引用PCLStorage NuGet包,以引用特定于平台的实现。” 但就像我说的,我在我的Wp8项目和PCL项目中引用的PCLStorage NuGet包与我在Win8项目中的方式相同。 知道发生了什么事吗? (我还应该注意,如果我在一个新的Wp8项目中使用它,PCLStorage工作正常)

VS 2015中的类库 – 构建跨平台库

我可以在安装了Xamarin的VS 2015中创建不同的类库: class级图书馆 类库(Android) class级图书馆(包) 类库(适用于通用应用程序) 类库(便携式) 类库(Xamarin.Forms) 我很想知道每个之间的区别 – 只是一个简短的会做:) 情景 我们的团队目前正在开发一个新项目,我们主要针对多个平台 – 网络和移动(Xamarin)。 虽然我们决定首先关注MVC Web应用程序,但我们希望创建一个包含所有模型和业务类(逻辑)的项目,以便以后可以在我们的项目中使用它。 哪个类库最合适?

可移植类库中的System.ComponentModel.DescriptionAttribute

我在枚举中使用Description属性为枚举字段提供用户友好名称。 例如 public enum InstallationType { [Description(“Forward of Bulk Head”)] FORWARD = 0, [Description(“Rear of Bulk Head”)] REAR = 1, [Description(“Roof Mounted”)] ROOF = 2, } 使用一个很好的帮助方法很容易访问它: public static string GetDescriptionFromEnumValue(Enum value) { DescriptionAttribute attribute = value.GetType() .GetField(value.ToString()) .GetCustomAttributes(typeof(DescriptionAttribute), false) .SingleOrDefault() as DescriptionAttribute; return attribute == null ? value.ToString() : attribute.Description; } 我需要将其转换为可移植的类库,但它似乎无法访问System.ComponentModel库。 当我尝试添加崇敬时VS告诉我,我已经引用了所有内容。 谢谢

在可移植类库中使用SQLite

最近我们开始研究一个新项目,其中包括Windows 8 Metro,Windows Phone和桌面应用程序的客户端。 决定使用MVVM模式作为主要架构,因为在项目之间共享ViewModel对我们来说是更可接受的解决方案。 我们决定为此目的使用可移植类库,但问题是在我们尝试添加对适当库的引用后,从Visualstudio 2012扩展库下载并安装SQLite for Windows运行时,我们根本看不到这些库。 这让我们想到,在Portable类库项目中不可能使用SQLite。 也许你已经完成了一些并知道我们实现这种function的方式? 请提供正确的方法来开发此任务,因为使用SQLite并且在开发的这个阶段具有可重用的代码非常重要