Link 3.5 build from 4.0 winforms phail

So I have this utility library which is compiled as a dll in .net 3.5 and used by my asp.net 3.5 site. I have created a winforms.net 4.0 application to output data to a website. I want to use functionality in utility library from this winforms application.

The problem is that when I link to a utility library and use the code in it, intellisense barks at me saying it cannot find objects in that library. Thing is, I would switch my winforms app to 3.5 which fixes the problem, but I am using Tasks which requires 4.0. And since my websites and utilities library is running as 3.5 and my site is hosted on godaddy which currently only supports asp.net 3.5, so compiling my utility-library under 4.0 for my winforms app won't work because it crashes my site.

I've tried using the app.config trick alaLegacyV2RuntimeActivationPolicy = "true" ...

  

But it did not help. Obviously I could start a new utility project for 4.0 and copy the code files from the existing utility library and then link to the new utility 4.0 in my winforms application, but this strikes me as overkill when all I want to do is link to libraries and use its functionality. Not to mention, I have two utility libraries containing the same code, and if I update the code in one I will need to make sure it is also updated. I could use the add file as a reference, but you got the idea.

So is there anything else I could try or any other way to solve or work around this? Or I'll just have to break and create an identical clone of the utility library for 4.0.

+2


a source to share


1 answer


You can redirect dll links using an element <assemblyBinding>

in the appconfig file, but this is a slippery road.



What I did in a similar situation is that I created 2 different project files in the same directory - one for 4.0 (VS2010) and another for 3.5 (VS2008). This way I only have 2 different project files above the same set of actual source files

0


a source







All Articles