CsvHelper icon indicating copy to clipboard operation
CsvHelper copied to clipboard

Missing GetRecords

Open LorenDorez opened this issue 11 years ago • 20 comments

Im using ASP.net 5 with an MVC6 project and when i try to reference savReader.GetRecords it throws and error that it isnt found

LorenDorez avatar Nov 11 '15 18:11 LorenDorez

Take a look at where the CsvHelper.dll is referenced. I bet it's going to the 2.0 folder. If this is the case, remove it, and manually add it to the correct folder in the NuGet package. NuGet has issues it certain scenarios where it'll use the 2.0 version instead of the 4.0 client profile version.

JoshClose avatar Nov 11 '15 19:11 JoshClose

Hi Josh,

Sorry im new to all of this. Im using VS2015 and just referenced CSVHelper in my project.json. HOw do i check the reference and manually update it?

LorenDorez avatar Nov 11 '15 19:11 LorenDorez

Hmm... I haven't used a version that uses project.json yet. Do you have a references folder that lists all of the assemblies that the project is using, or is it just the json file? Does the json file have paths to the assemblies in it?

JoshClose avatar Nov 11 '15 19:11 JoshClose

OK i found them DNX (Asp.net 5) saves them to C:\Users[UserName].dnx\Packages[Package]

So i have version 2.13.2 and in this folder i have a lib, CsvHelper.2.13.2.nupkg, a SHA512 and nuspec Files

LorenDorez avatar Nov 11 '15 19:11 LorenDorez

I don't know if .NET 4.0 or PCL assemblies work with DNX. That is something I will have to into further. I haven't done anything with it since it's still in beta.

JoshClose avatar Nov 11 '15 19:11 JoshClose

OK, yeah im going to have to try and track down how it determines which version to use. As i see no true linking between the new project and the nuget package

LorenDorez avatar Nov 11 '15 19:11 LorenDorez

Found it. there is project.lock.json which has the references and it showing in several places. Ill update them here but need to know how to fix this so the next update doesnt break it

"CsvHelper/2.13.2": {
        "type": "package",
        "compile": {
          "lib/net20/CsvHelper.dll": {}
        },
        "runtime": {
          "lib/net20/CsvHelper.dll": {}
        }
      },

LorenDorez avatar Nov 11 '15 19:11 LorenDorez

I'm guessing whatever it is that determines which version to download is choosing the wrong one... Or none of the other packages are compatible. There is .NET 4.0 client profile, and PCL. It could be that neither of those are compatible with DNX. I may have to make a DNX specific package, but I'm not sure.

Let me know if you get it working. I will take a look at this (DNX support) at some point, but it probably won't be soon.

JoshClose avatar Nov 11 '15 19:11 JoshClose

I look at other project that im referencing and i noticed that you .Net 4 folder is called net40-client while others are calling it net40. You can look at the Automapper nuget package for example. as this appears to be how DNX if choosing the package and since net20 is the only one it sees as valid it choosing that one as it looking for net40

LorenDorez avatar Nov 11 '15 19:11 LorenDorez

I get an error that it doesnt support 4.5 so no luck. Ill wait until theres a 4.5 version. Thanks Josh

LorenDorez avatar Nov 11 '15 20:11 LorenDorez

net40-client is .NET 4.0 client profile. The client profile is just a smaller set of .NET and is usable in more places than the full .NET library. If net40 works, net40-client should too.

JoshClose avatar Nov 11 '15 20:11 JoshClose

I managed to get it to work. I was doing a Replace All "net20" with "net40-client" and didnt realize there a section where it list all the available versions for each package and it was replacing there as ell. Once i manually replaced just the sections for DNX Targets its appears to be working

LorenDorez avatar Nov 11 '15 21:11 LorenDorez

Oh that's good. I'll look into having a DNX specific build in the future. Probably once it's closer to release.

JoshClose avatar Nov 12 '15 15:11 JoshClose

I have just run into this issue as well. LorenDorez's solution works, but it is a temporary fix and I cannot figure out how to make this permanent.

dlras2 avatar Nov 14 '15 17:11 dlras2

@dlras2 I havent had an issue with mine. How is yours being Temporary?

LorenDorez avatar Nov 18 '15 15:11 LorenDorez

Whenever project.lock.json is regenerated they are reset to net20. I'm not sure what the criteria are for this file be regenerated, but I know it's happened several time, and is not checked in to source control so will break when built on a fresh machine.

dlras2 avatar Nov 18 '15 15:11 dlras2

I just posted to the DNX Github and speaking with David Fowler right now

LorenDorez avatar Nov 18 '15 16:11 LorenDorez

Great!

JoshClose avatar Nov 18 '15 17:11 JoshClose

@LorenDorez check issue #44 for a hack I posted that will save you from having to re-edit your project.lock.json every time it changes. It's a hack of course, and doesn't address the root cause of the problem, but it makes this easier.

cda-1 avatar Dec 05 '15 04:12 cda-1

.NET Core is now supported and the client profile isn't used anymore, so this issue shouldn't happen now.

JoshClose avatar Sep 30 '16 06:09 JoshClose