I am defining some Expression variables in my app and need to have a reference to Microsoft.Scripting.Core. That assembly includes the same namespace as the System.Core assembly from the main .Net framework.
I want to use the defintions from the System.Core assembly as it’s stable whereas the Microsoft.Scripting.Core is alpha.
How do I tell my app to preference the System.Linq.Expressions namespace in System.Core instead of Microsoft.Scripting.Core but still be able to keep the reference to it?
As Marc says, it’s not terribly nice – but extern aliases are the way to go.
In the “References” part of solution explorer, select the
System.Coreassembly, go to properties. Change the “Aliases” property to include “syscore”, e.g.Then at the top of any file where you want to use
System.Linq.Expressions, type:It’s ugly, but at least it’s possible 🙂
As a caveat, I’ve seen some problems when it comes to extension methods and extern aliases, as described in this question.