3

I am building a new project in ASP.NET 5. In my solution I have added a new Class Library (Package) project.

I right click on this project and choose for Manage Nuget packages to install PetaPoco.Core.

When I install everything seems fine except that the PetaPoco.cs file is not in my project.

In my references I se the PetaPoco version 5.1.171 installed.

Is this something different then a normal class library and do I need to use something else in order to use the installed PetaPoco class or is it a problem during the installation?

I have removed and reinstalled this but still the same.

Someone that can help me out?

/Michael

Mivaweb
  • 5,580
  • 3
  • 27
  • 53

2 Answers2

1

It looks like the PetaPoco.Core package isn't setup to be used in portable class libraries (PCLs).

Including content files in PCLs like the Models folder that PetaPoco.Core creates requires a different NuGet setup than a regular project. Documentation on this can be found on NuGet. I downloaded their package directly and can confirm that it is not setup in the way the linked resource describes.

It may be that the project requires features that are not available yet cross-platform, or they simply haven't had time to make changes to support PCLs, or some other reason that I am not aware of.

Will Ray
  • 10,621
  • 3
  • 46
  • 61
0

NuGet packages are usually installed as DLLs in the bin folder of your project, with the needed references also added automatically to the project. They usually don't include source files. You may find sources - if available - on the package/project website.

Visual Studio IntelliSense will pick up the DLLs and show what it can about the classes and methods inside, including comments and method signatures.

See here for a tutorial, including how to build your own NuGet packages.

EDIT: PetaPoco is the exception that does add a .cs file... see comment below.

Peter B
  • 22,460
  • 5
  • 32
  • 69
  • In my Class library project I can't see any bin folder or dll's is that normal? – Mivaweb Apr 29 '16 at 10:53
  • Because I still can't use the namespace `PetaPoco` by doing `using PetaPoco;` – Mivaweb Apr 29 '16 at 10:55
  • I just noticed that in the case of PetaPoco, the NuGet package DOES include a PetaPoco.cs file; it is put in the `Models` folder. I had to create a stub `App.config` file before I could build my test class lib with PetaPoco included, and then I could use PetaPoco classes in my code. – Peter B Apr 29 '16 at 11:13
  • Yes I know but for some reasing in the Class library (package) .net 4.6 is does not do this. I have created a new project in 4.5.1 and there it works perfectly. – Mivaweb Apr 29 '16 at 11:23