问题标签 [portable-class-library]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
microsoft-metro - 调试器无法识别等待方法的返回值的变量
我在针对 .NET 4.5 和 Windows Store Apps 的可移植类库中有这个非常简单的代码:
当我在第二行放置断点并运行我的应用程序时,断点被正确命中,但我无法调查调试器中的响应,因为它报告:
当前上下文中不存在名称“响应”
我不确定它有多少相关性,但我还必须在调试器的设置中禁用“仅我的代码”调试器设置,以便能够调试与执行应用程序放置在同一解决方案中的可移植类库。
是 async-await 方法、可移植类库、目标应用程序(尤其是 Windows Store App)还是这些工具的组合的一些限制?或者它是一个调试器错误?任何解决方法都会很有帮助。
.net - 如何为 .NET 可移植类库创建单元测试程序集?
我正在尝试对我创建的可移植类库进行单元测试,并且我想确保它正在使用它所针对的相同框架子集进行测试。
根据 Visual Studio ALM + Team Foundation Server 博客,MSTest 单元测试框架在 Visual Studio 2012 RC 中转换为 PCL;但是,我无法创建可移植类库,然后在 VS2012 RTM 中引用 MSTest 框架。
- 在“参考”对话框中浏览显示没有单元测试组件被注册为与 PCL 兼容。
- 在项目文件中添加手动 GAC 参考会
Microsoft.VisualStudio.QualityTools.UnitTestFramework
产生参考未找到构建错误。 - 添加手动直接程序集引用以
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
产生构建警告,指出 UnitTestFramework 程序集引用了不兼容的mscorlib
版本。
我确实发现(感谢早期的回答)有一个项目Unit Test Library (Windows Store apps)
类型在. 这种项目类型创建了一个小型的无 UI Windows 应用商店应用程序......完整的清单和一切。它也不允许我指定我所针对的框架 - 它似乎仅适用于 Windows Store 应用程序。C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\MSTestFramework\11.0\References\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.UnitTestFramework.dll
在潜在的错误假设下,我应该使用单元测试程序集来测试我的可移植类库项目,这些程序集的目标是与被测库相同的框架子集......
如何为 .NET 可移植类库创建单元测试程序集?
(我对也针对 PCL 的其他框架持开放态度,我只是目前不知道除 MSTest 之外的其他解决方案已考虑到这一点。)
c# - System.Collections.ObjectModel.ObservableCollection`1 Error
I'm using ObservableCollection in a portable library but I'm getting the error below. How can I solve this problem?
'System.Collections.ObjectModel.ObservableCollection
1<MyClass>' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Collections.ObjectModel.ObservableCollection
1' could be found (are you missing a using directive or an assembly reference?)
edited: I have this class in a portable library
and trying to use it in a WCF Service.
Second Edit: I figured it out by putting my class having the observable collection property to a different project/library. But I'm still wondering why I got that strange error.
Another solution for this question would be a better solution structure for my projects. I'm still trying to manage it.
I am designing a Silverlight project consuming a WCF service. I have some common classes to share in both Silverlight and the WCF Service. I could not make it work by using just a portable class and share because I need some data structures to use like ObservableCollection and SortedList etc. Portable classes do not have this. Because of that reason I am having Surrogate classes in different libraries but this doesnt look good. How should I design it?
c# - 可移植类库 (PCL) 贡献 - 密码学
我想在 codeplex 上的 Portable Class Library Contrib 项目中使用密码学,但没有找到任何关于如何使用它的文档。
我想创建一个包含其中的方法的包装类,Encrypt
并且Decrypt
我希望这个包装类存在于可移植类库中。我已经在这个项目中引用了Portable.Runtime
和。Portable.Security.Cryptography
它是否正确?
然后我想在 .NET、Windows Phone 和 Metro 项目中使用我的包装器。在这些项目中,我引用了我的包装项目,Portable.Runtime
以及Portable.Security.Cryptography
相应的便携式项目,即Portable.Desktop
,Portable.Phone
或Portable.WindowsStore
。它是否正确?
然而,当我尝试使用我的包装类时,我得到了冲突的命名空间错误。这是错误和我的包装类:
该类型
System.Security.Cryptography.AesManaged
同时存在于C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Core.dll
和C:\Downloads\PclContrib\bin\Debug\Portable.Security.Cryptography.dll
c# - 为什么在便携式库类中我无法实例化 ValidationContext 以及如何修复它?
我正在便携式库类中创建我的域对象。那些应该实施INotifyPropertChanged
和INotifyDataErrorInfo
所以,我的域类应该实现这个基类
但我意识到在这一行
我无法创建对象 ValidationContext 因为它没有任何构造函数。我该怎么做才能创建新的?
更新 根据我的智能感知,这包含。
c# - 面向 .NET4.5、SL 和 Windows 应用商店应用的便携式库类的 MEF
我正在使用一个可移植的库类,我的目标是 .NET 4.5、Silverlight 5 和 Windows Store 应用程序。
根据 MSDN,可以在这三个平台中使用 MEF:http: //msdn.microsoft.com/en-us/library/gg597391.aspx
但我无法在这些平台中使用 MEF。在 PCL 中使用 MEF 的正确方法是什么?
c# - 可移植类库:推荐替换 [Serializable]
我正在将 .NET Framework C# 类库移植到可移植类库。一个反复出现的问题是如何处理用该[Serializable]
属性修饰的类,因为该属性不是可移植类库子集的一部分。可移植类库子集中的序列化功能似乎由DataContractAttribute覆盖。
- 为了在可移植类库中保留尽可能多的功能,
[Serializable]
用[DataContract]
属性替换是否就足够了(这意味着所有受序列化的字段和属性也需要进行修饰[DataMember]
)? - 我不能用我可以应用的这种方法做什么(如果有的话)
[Serializable]
? - 有没有侵入性较小的方法?
鉴于[DataContract]
和[DataMember]
被使用,我正在考虑按照以下几行更改代码。这种方法有什么明显的缺陷吗?有什么办法可以让同样的事情变得不那么冗长吗?
.net - 可移植类库 Contrib 在重新分发的库中
我在PCL Contrib的帮助下创建了一个可移植类库。为了使 PCL Contrib 正常工作,我了解您还必须包含适当的 Portable。项目中将使用可移植类库的平台.dll(平台是 Desktop、Silverlight 等)。我创建的 PCL 将被重新分发,我想通过不要求任何使用 PCL 的人必须包含多个 DLL 来使其工作来简化它的使用。有没有办法可以滚动 PCL DLL,即 Portable。平台DLL 和其他特定于平台的抽象(参见PCL 平台抽象)到每个平台的单个 DLL 中?
我想继续使用 PCL,以将我的大部分代码保留在一个可管理的区域中,即使它需要(在某种程度上)拆分为特定于平台的包。我觉得这将尽可能多地重用代码。
silverlight-5.0 - 在 .Net 便携式子集中看不到 ICustomTypeProvider
我在一个项目中创建了一个可移植类库,以在 Silverlight 5 解决方案中保存一些通用代码。我想实现 ICustomTypeProvider 来创建一些灵活的对象,但是我在 PCL 中看不到接口,即使我只选择 .Net Framework 和 SL5 作为库的目标。
System.Reflection出现在4.5框架和SL5中,为什么看不到界面?
c# - 如何在可移植类库中检索持久 wcf 服务的 instanceId?
我尝试WCF service
使用可移植的辅助类从持久化中获取 instanceId .net assembly
。要检索 id,我需要调用:
但IContextManager
不包含在可移植类库中:如何在可移植类库中检索 instanceId?