ExcelDna icon indicating copy to clipboard operation
ExcelDna copied to clipboard

ExcelDna.Integration contains no types and other errors after upgrade

Open govert opened this issue 3 years ago • 5 comments

We now target .NET 4.5+ in the NuGet package for v. 1.2 If a project is targeting an older version of .NET, e.g. .NET 4, then upgrading the package leads to confusing errors until the project is upgraded. Is there a way to give a more sensible message? For example, though maybe there is a better plan, make some library that targets .NET 4 where everything is stubbed out and marked obsolete.

govert avatar Feb 17 '21 11:02 govert

I see this warning after upgrading to v1.2 on a .NET 4 project:

The primary reference "ExcelDna.Integration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0"

image


I thought the message was clear enough for me... Do you not see the same warning?

augustoproiete avatar Feb 17 '21 14:02 augustoproiete

Yes I see this warning. It is somewhat hidden by the errors that don't make sense for types that are not defined. I'm wondering if there is a better upgrade experience, or at least want to make an issue people can find easily. It's certainly not a big problem, and I'm happy to require the update to 4.5.

govert avatar Feb 17 '21 16:02 govert

errors that don't make sense I mean errors that are hard to understand given that the package was just updated, and the assembly reference is in place.

govert avatar Feb 17 '21 16:02 govert

Yes I see this warning. It is somewhat hidden by the errors that don't make sense for types that are not defined.

Hmm... I see. My test above was on an empty class library, so I got zero compilation errors... Just the warning. Much easier to spot.

I don't know how many users are targeting < .NET 4.5, so hard to have an opinion if it's worth investing time on this, but one possible path would be to add a target in the ExcelDna.Addin.targets file that looks at the TFM of the project and emits an error.

It can be done either during build (so one more error to the list), or can be done upon installation of the package (before build) via InitialTargets.

You can see an example of InitialTargets working, in the IAmRoot nuget package.


Also, removing TFMs is a breaking change, so it would make sense to follow semver and release vNext as 2.0.x instead of 1.2.x and document the new requirements. Bumping the major version usually cause people to pay more attention to the docs before upgrading, so the confusing errors might not be a big issue.

augustoproiete avatar Feb 17 '21 17:02 augustoproiete

I don't think it is a big problem - I just wanted to document it. I ran into it with an old project that was just targeting .NET 4 historically - I imagine some users have such old projects that just have not had any reason to update.

Your point about whether this should be a major version update is valid.

govert avatar Feb 17 '21 17:02 govert