portable-class-library

How to connect with SQL Server database using .NET Core Class Library (.NET Standard)?

别来无恙 提交于 2019-12-05 10:54:27
I have just started to create an ASP.NET Core Web API Project. I am not much aware of "ASP.NET Core .NET Standard Library". I am creating this application using Visual Studio 2017 RC and in the application, I have taken a project of type Class Library (.NET Standard) at repository layer. Following is the screenshot for the same: Now from repository Layer I want to connect to the database. I have created a variable IDbConnection con; Now I am trying to add reference of System.Data but I am unable to add any reference because when I am opening the add reference window then I am getting the

NuGet and Portable Class Libraries - Package doesn't target any framework

霸气de小男生 提交于 2019-12-05 10:13:35
I have been using NuGet to manage my internally created assemblies for a few months, and it's working very well. I recently 'discovered' portable class libraries, which has also been great - until it's time to install the packages. Say I have a PCL that targets .NET 4.5, SL5 and .NET for Windows Store Apps. I run nuget spec to create the .nuspec file, edit the values, package it up, and add the .nupkg to our internal feed. If I open the .nupkg file in the Package Explorer, I see one content folder under lib called portable-win+net45+sl50. When I try to install the package from any compatible

How can I replace Marshal.SizeOf(Object) with Marshal.SizeOf<T>()?

徘徊边缘 提交于 2019-12-05 08:12:10
I am building a Universal class library from existing code, and I get some compiler warnings that I for the life of it cannot figure out what to do with. I have code like this: void SomeMethod(Object data) { var size = Marshal.SizeOf(data); ... } The code builds, but in the Universal project (and, I guess, .NET 4.5.1 and higher projects) I get the following compiler warning: warning CS0618: 'System.Runtime.InteropServices.Marshal.SizeOf(object)' is obsolete: 'SizeOf(Object) may be unavailable in future releases. Instead, use SizeOf<T>(). But how do I create a replacement for Marshal.SizeOf

The type or namespace name 'Core' does not exist in the namespace 'AuntieDot'

孤街醉人 提交于 2019-12-05 06:34:35
I have 4 PCL's, and they are all targeted at the same Frameworks: AuntieDot: AuntieDot.Authentication: AuntieDot.Core: AuntieDot.Models: But for some reason, the usage of 'AuntieDot.Core.Helpers' in the 'AuntieDot.Authentication' namespace (despite 'AuntieDot.Core' being added as a reference into 'AuntieDot.Authentication', it's saying it doesn't exist. I've googled around and the only replies I've gotten is that I need to make sure the other libraries are targeted at the same frameworks, which they are. The only external code I'm using is JSON.net, which I added via NuGet so I don't think

How to change the PCL profile in Xamarin.Forms (Portable) Application

北城余情 提交于 2019-12-05 06:23:59
I just wanted to know about, how to change the PCL profile in Xamarin with Visual Studio 2015 Update 2. While installing some of the package, I am getting an error that, this package is not compatible with the PCL profile 259. Thank You in advance. Right-click on the PCL project and select Properties. Then, in the "Library" tab, select the "Change..." button under the Targeting section. Select the targets you want which match the profile you want. 来源: https://stackoverflow.com/questions/41813088/how-to-change-the-pcl-profile-in-xamarin-forms-portable-application

Progress bar for HttpClient uploading

旧时模样 提交于 2019-12-05 05:17:35
I want to run asynchronous uploads with a progress bar in WPF (and preferably use PCL for code reuse in Xamarin and SL too.) I've been trying to use System.Net.HttpClient. Unfortunately, PutAsync doesn't provide any progress notifications. (I know that it does for Windows.Web.Http.HttpClient, but that's not available for WPF, nor in the PCL). For downloading, its fairly easy to implement your own progress bar, as described here . You just pass the ResponseHeadersRead option, which makes the stream available as soon as the headers are returned, and then you read it in chunk by chunk,

Is there a RestSharp implementation that works with Portable Class Libraries?

感情迁移 提交于 2019-12-05 01:10:21
When I try to add RestSharp to a portable class library project using nuget, I get the following: Could not install package 'RestSharp 104.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile104', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. I assume then it is not supported? If that be the case anyone have any suggestions on how to get this to work? Nicola Iarocci Another interesting option is Flurl Flurl is a

TypeLoadException when using PCL in .NET application if called class contains [OnDeserialized] method

我只是一个虾纸丫 提交于 2019-12-05 00:33:44
I am adapting an existing .NET class library to a Portable Class Library. I am using profile 78 (.NET 4.5, Windows Store 8, Windows Phone 8) in favor of profile 158 (which also targets Silverlight 5) because I want to be able to compile the unsafe code of the original library. The .NET library contains quite a lot of classes marked [Serializable] , so I have implemented a support PCL library containing a dummy SerializableAttribute implementation: public class SerializableAttribute : Attribute { } which is referenced from the main PCL library. To sufficiently use the main PCL library in a .NET

How do I add a reference to F# Portable Library from C# Portable Class Library (PCL)

雨燕双飞 提交于 2019-12-04 23:07:52
I have a project which contains two F# projects and a C# project in which I'd like to write some XUnit tests: FS_PL: F# 3.1 (3.3.1.0) Portable Library FS_PL_Legacy: F# 31. (2.3.5.1) Portable Library (Legacy) Tests: C# .NET 4.5/Win8 C# Portable Class Library (PCL) I am unable to add a reference from Tests to either of the F# libraries. When I try to add a reference to FS_PL, I am presented with a dialog that states "Unable to add a reference to project 'FS_PL'. The targets of Portable Library project 'FS_PL' are not the same or compatible with the targets of the current Portable Library project

Can I get a “sometimes portable” class library project to load in Visual Studio Express?

早过忘川 提交于 2019-12-04 22:13:42
For Noda Time version 1.1, the main goal is to build a Portable Class Library flavour, primarily to support Windows Phone and Windows Store apps. This means losing some functionality, so we build a desktop configuration and a PCL configuration (for each of debug, release, and "signed release"). To avoid having to work with umpteen project files, all of the 6 configurations exist in the same project file. The project file is customized to generate a property called "Portability", which is set to either "PCL" or "Desktop", like this: <!-- Set the custom Portability property based on