Problem with versioning

I installed the latest version. I choose to extract the Flexcell.dll file for .NET Framework 4.0. I updated that file in my Bin directory. When I try to compile the project, I have:



The primary reference "FlexCel, Version=6.7.12.0, Culture=neutral, PublicKeyToken=cb8f6080e6d5a4d6, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".



So, the project cannot compile.



I would have expected that if I would have tried to compile the project with FlexCel.dll from the D:\TMSSoftware\FlexCelNET\lib\net46 directory. But, I really took it from D:\TMSSoftware\FlexCelNET\lib\net40.



I tried that several times and it just does not work.



My project is set to compile, as indicated above, for .NET Framework 4.0.



I cannot compile for .NET Framework 4.6 as I still have environment using Windows Server 2003 and that max out at .NET Framework 4.0.



Are you still the file in D:\TMSSoftware\FlexCelNET\lib\net40 was really a file built for .NET Framework 4.0? If yes, why can't I use it?



Hi,


This is weird: I've rechecked by installing it here, and the dll in \net40 is indeed a .NET 4.0 dll.
I also tried making an app which referenced it, and setting the app to compile with .NET 40, and it worked fine.

If you open a powershell window and type:

 [Reflection.Assembly]::ReflectionOnlyLoadFrom("D:\TMSSoftware\FlexCelNET\lib\net40\FlexCel.dll").ImageRuntimeVersion

what do you see?
I tried it here and I see v4.0.30319

And as said, If I do a simple app, set it to use .NET 4, and then reference that assembly it runs fine. If I change the reference to the dll in net46, I get the same error as you do, and that is expected.

You are mentioning you update that file in your bin directory. Maybe this is something related?  You shouldn't need to update any file in the bin directory: If you have the correct reference when compiling, it will be copied. And actually, if you update the bin folder but not the reference itself, when you build the file in the bin folder will be overwritten again to be what the reference says.

Can you make sure that the reference is to the FlexCel.dll in the net40 folder?
Make sure that the path of the reference is to the net40 folder, and that the runtime version is 4.0 and not 4.6:



I can't think in much more reasons why it wouldn't work

I checked in Powershell and it is exactly as you mentioned.



When I referenced directly your file in the TMS directory, it worked.



But, I need to preserve all Bin files into the framework Bin folder. When that file is there, it now compiles. So, I assume the temporary change to link directly to your folder reset something.



However, I have a warning:



Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.



In order to avoid that, I have to add this in the configuration file:



    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>



I did not have to do that before.



I am also not sure if I would like to have that setting as I do not know the impact.



Do you know why I am forced to add that setting now to avoid the conflict?

Ok, this was related to a bug in Visual Studio.



If the framework project updates a reference of a library, if the child project is opened, it will give this. We have to close the child project and re open it and there is no more warning.