PandaWood/ExceptionReporter.NET

Compatibility with new nuget PackageReference format

vbtrek opened this issue · 12 comments

Hi,
I'm using v2.4.1 nuget package in my Visual Studio 2017 project, I added the nuget package as a PackageReference. When I try to build my project it gives me the error:

Severity Code Description Project File Line Suppression State Error CS2015 'C:\Users\zzz\.nuget\packages\exceptionreporter\2.4.1\contentFiles\any\net40\warning.ico' is a binary file instead of a text file Intact.DevInternal.Common D:\OneDrive\Work\OneDrive - Intact Software\DEV\Projects\Developer Utilities\Developer Tools\Intact.DevInternal.Common\CSC 1 Active

I don't know anything about nuget packages but this:
https://blog.nuget.org/20160126/nuget-contentFiles-demystified.html

Seems to suggest that the images should be in an images sub folder and added to the nuspec as an EmbeddedResource?

It sounds like you haven't added the nuget package properly - and are trying to add it as a reference instead of via the "Add Nuget Packages" or "Manage Nuget Packages"...? Let me know exactly what you're doing.

I just tested adding the ExceptionReporter.NET nuget package 2.4.1 into 3 separate projects, using Visual Studio 2017 for Windows for 2 of them and VS2017 for Mac for the other - and they all worked without any build errors. I've also added and tested 2.4.1 via nuget for a project at my company... so I'm pretty confident there's nothing wrong with the package.

BTW The nuget package is actually created by Visual Studio 2017 - I practically just give it a name and it does the rest ;-)

I did add through "Manage Nuget Packages", you will only get the issue if you have no other nuget packages in the project, and you set the Options -> Nuget Package Manager -> General -> Default package management format to PackageReference then add the nuget package. It should appear in the References list with a blue icon.

Right, this looks like a new feature introduced a few months ago, I hadn't even heard of - https://docs.microsoft.com/en-us/nuget/reference/migrate-packages-config-to-package-reference

But there is an expectation that many packages can't/won't support this format.

I will be able to support it as soon as the VisualStudio2017 package creator does - since that's what I use.

I'll look out for it, thanks for the information.

No problem, I think PackageReference was added in VS2017. I thought it's main purpose with eliminate duplicate packages on you disk, by storing downloaded packages in "C:\Users<ME>.nuget" rather than in a packages subfolder, but I guess it's doing more than that.

Out of interest, where do you get the VisualStudio2017 package creator, I can't find it anywhere?

I use Visual Studio 2017 for Mac - it has an option to "create nuget package" and added options in the project to support it. The Windows version doesn't have it - which is very surprising.

How odd, I was wondering if you changed the Build Action Property of the warning.ico from Content to None whether that would fix the issue, I was going to test it out but couldn't work out how to build the nuget package :)

I'm looking into this now and I can reproduce it.

I just did a PackageReference conversion to a project in Visual Studio 2017 (Windows) which contained ExceptionReporter.NET and though it didn't show anything about ExceptionReporter in the "NuGet Migration Report" - I do get the same compile error you've mentioned.

So I'll keep this issue open and try to figure it out - maybe your initial suggestion was right.

I removed the offending image "warning.ico" from the root of the project.
It was only used as the "Project Icon" in the project settings.
Removing it doesn't seem to affect anything else and fixes the compile error when using the PackageReference nuget format.

It's possible this is a bug in nuget so I should get around to reporting it as an issue to find out.

The fix for this is in 2.4.2 - let me know how it goes if you ever get the chance to try it out.

That works spot on now, thanks.