2

I have an .net assembly build against 3.5 framework. This assembly has a class Foo with two method overrides:

public class Foo {
    public T Set<T>(T value);
    public T Set<T>(Func<T> getValueFunc);
}

I'm referencing this assembly in my asp.net 2.0 web application to use first override of the Set method (without Func).

But on build I get an error saying that I should reference System.Core to use System.Func delegate... but I'm not using this type...

Is there a workaround to solve this?

PS: There is no option to convert my web application targeting 3.5 framework.

2
  • Do you have access to the source code for the referenced assembly? Commented May 21, 2010 at 11:30
  • Yes, I do. But it is a large library heavily using 3.5 internally, so recompiling against 2.0 is also not the option... Commented May 21, 2010 at 12:03

3 Answers 3

2

Convert your web app to use .NET 3.5 (or 4.0). After that, everything will be fine.

If you have to stick to .NET 2.0, here are my ideas

  • Try to reference the System.Core assembly by browsing to the dll and manually adding it. The .NET Framework 3.5 uses the same CLR as 2.0, so it should work if it doesn't have screwed up references. (eg. stuff from .NET 3.5 that you can't add)
Sign up to request clarification or add additional context in comments.

1 Comment

Solved it by referencing System.Core as described here (abdullin.com/journal/2008/12/23/…). Failed to add reference just by browsing to assembly on my system...
0

Just because you are not calling a particular overload in your code does not mean that the compiler can ignore it, if it exists in a class you are using then the compiler needs to know what it is. You either need reference System.Core or convert your project to use .net 3.5

Comments

-1

You must upgrade your web-application to .net 3.5 in order to make this work or recompile the assembly from soce targetting .net 2.0 if at all it is possible.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.