Can't set reference to wealthlab.dll through VS2008
Author: bobydesi123
Creation Date: 6/9/2013 11:51 AM
profile picture

bobydesi123

#1
Hi (Eugene, cone),
I haven't tried debugging WLscript using VS2008 in a while. I have a 64 bit machine and 64bit WLP.
The error i get from VS2008 while setting reference to wealthlab.dll is as follows:

Warning 4 Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'C:\Program Files\Fidelity Investments\Wealth-Lab Pro 6\WealthLab.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. WLDebugTry

Seems like different CLR problem? Do i need to upgrade to VS2012? Any solution is appreciated. WLP is not running while i am using VS2008.
profile picture

bobydesi123

#2
I have .NET 3.5..may be need .NET 4?
profile picture

Eugene

#3
Wealth-Lab 6.4 (and 6.5 soon) requires .NET 4.0.
profile picture

bobydesi123

#4
Eugene,
VS2008 did not allow me to reference the wealthlab.dll because it does not support .NET 4 (up to 3.5 only)
So. i installed VS2010 ultimate which installed .NET 4 frame work. I was able to reference the wealthlab.dll and compile my strategy in vs2010.
The problem now have is the WLP doesn't work! Every time i start WLP, i get message 'WLP stopped working'!!!
I think in order to get the proverbial goat out of tent, i have got camel in the tent! I have pc with vista-64 bit running.
What now?
profile picture

bobydesi123

#5
Did system restore to before installing VS2010 ultimate. Now WLP works! Whatever .NET4 extended components were installed by vs2010 seems to have cause the problem with WLP. Phew!
profile picture

Eugene

#6
I don't think your theory is correct. It's rather something trivial like targeting your library for x64 in VS2010 while running 32-bit WLP. A more detailed description of your actions during build, referenced assemblies and project properties could help.
profile picture

bobydesi123

#7
Eugene,
I think you are right as usual. Here is what i think, the problem is:
I have WLP 64 bit installed.
In wlp every time i try to create a new strategy from menu =>New=>strategy from code.
I get the error :CS0006 : metadata C:\Program Files (x86)\Fidelity Investments\Wealth-Lab Pro 6\wealthlab.dll coud not be found. I always have to go and change the reference to :C:\Program Files\Fidelity Investments\Wealth-Lab Pro 6\wealthlab.dll manually.
I think that is the problem. When try debugging with VS2010 the WLP probably looks for reference in Program Files (x86)

How do i set the default reference in WL to C:\Program Files\Fidelity Investments\Wealth-Lab Pro 6\wealthlab.dll?
Why does the 64 bit WLP has default reference to C:\Program Files (x86)\Fidelity Investments\Wealth-Lab Pro 6\wealthlab.dll?
Thanks in advance.
profile picture

Eugene

#8
64-bit WLP does not have a default reference pointing to the 32-bit installation. You referenced the 32-bit WealthLab.dll when compiling, or inadvertently set x86 when compiling your solution (you tell me what you did), and that assembly file got copied to the 64-bit WLP main folder.

1. Inspect "References..." in the Strategy Editor (for example, if you've overridden the Default Strategy Template)
2. Try an uninstall of WLP, purge the remaining files in the main folder, do a clean install.
3. In VS2010, inspect your references to WL's DLLs (so they point to 64-bit WLP) and ensure that "Any CPU" is targeted in Configuration Manager. Avoid having "Copy Local = True" for the referenced DLLs if Output Path is set to the WLP main folder.
profile picture

bobydesi123

#9

The following is the list of project property.
If i delete the dlls created by the VS2010, then WLP starts fine.






CODE:
Please log in to see this code.
profile picture

Eugene

#10
1. In Wealth-Lab's Strategy Editor, remove the WealthLab.dll reference. It's absolutely unnecessary. Save the default template. Adding that reference is meant only for Visual Studio projects, not for the regular code-based Strategies in Wealth-Lab.

2. In the compiled strategy's code, implement all properties that currently throw a NotImplementedException to avoid throwing exceptions or crashing Wealth-Lab.

3. You seem to have overlooked #3 from my previous reply, as I didn't find it on your screenshots? The idea is to inspect each Wealth-Lab DLL referenced in your VS2010 solution. To reiterate:

In VS2010, inspect your references to WL's DLLs (so they point to 64-bit WLP). Avoid having set "Copy Local = True" for the referenced DLLs if Output Path is set to the WLP main folder.

Simply put, you could've referenced a 32-bit DLL before by pointing to the 32-bit installation folder. However, I'm not sure as that usually leads to a startup crash.

P.S. Your image links haven't been working from the start, so I edited your replies, inserting the direct image file link into the IMG tags. Next time simply insert the direct link and use IMG tags, here's an URL for example:

http://www.image-share.com/upload/2187/138.jpg
profile picture

bobydesi123

#11
Eugene,
Your suggestion #2 did the job. I guess NotImplementedException() was probably crashing the WLP;
QUOTE:
2. In the compiled strategy's code, implement all properties that currently throw a NotImplementedException to avoid throwing exceptions or crashing Wealth-Lab.

Thank you so much for pretty much holding my hand through this problem. Have a nice day. Hopefully, you wont hear from me for at least a few days! :)