MIH8
- ago
Hello everybody.

Today i would like to ask you and the community to guide me through the necessery steps.

I am not experienced with the C# IDE, but the first steps were easy.

1. WL8 is installed and running
2. VS 2022 is intalled and running (.Net Framework is up to date)
3. I created a C# class project and made a copy paste strategy. I used SevemteenLiner renamed it to VS_SeventeenLiner
4. I referenced necessary wealth lab dlls
5. I compiled the project successfully

Now further steps are not clear to me. How do i need to continue?

The goal, of course, is to run the strategy with VS so I can debug my code or just have a little more programming comfort.
Do I need to move some dlls or do I need to attach processes? What do I need to configure in WL8 so I can run the strategy from VS?

In any case, simply starting the strategy does not get the job done.
Based on articles on previous versions of WL8, I have not succeeded so far.

Help is very much appreciated. Thank you.
0
1,153
Solved
19 Replies

Reply

Bookmark

Sort
- ago
#1
Hi,

So as not to repeat what's been said and done, could you be specific as to what steps you're taking to launch the project under debugger, set breakpoints and figure out it's not working?

https://www.wealth-lab.com/Discussion/New-instruction-for-using-Visual-Studio-to-develop-and-debug-strategies-5494
https://www.wealth-lab.com/Discussion/How-to-use-Visual-Studio-in-conjunction-with-WL7-6096
https://www.wealth-lab.com/Discussion/WL8-Visual-Studio-Debugging-7896
0
MIH8
- ago
#2
Hello Eugene, thanks so far. I have had a superficial look already into most of the links above. Currently i look into https://www.wealth-lab.com/Discussion/Configuring-Visual-Studio-2022-output-7842

So, i made a little progress so far. One issue for me was to redirect the output. So i changed the path in the project file as others did too. First it did not work, i had to run VS in admin mode before the project files were created in.

"C:\Program Files\Quantacula, LLC\WealthLab 8\x64\Debug\net6.0"

So, checked and solved two points.

CODE:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable>    <BaseOutputPath>C:\Program Files\Quantacula, LLC\WealthLab 8</BaseOutputPath>    <Platforms>AnyCPU;x64</Platforms> </PropertyGroup> <ItemGroup> <Reference Include="WealthLab.Core"> <HintPath>..\..\..\..\..\..\Program Files\Quantacula, LLC\WealthLab 8\WealthLab.Core.dll</HintPath> </Reference> </ItemGroup> </Project>


If i now run the project in VS i get the following error message.
The profile "VS_Strategy" can not be executed from this project.
Maybe you can push me into the right direction where to continue now.

1
- ago
#3
Not sure, is your VS installation complete? This post may help:

QUOTE:
Fixed! I haven't installed .Net Desktopdeveloping! I dont know why but yeah


https://stackoverflow.com/questions/71351970/visual-studio-2022-the-profile-cannot-be-executed-by-the-project
0
MIH8
- ago
#4
Very good. The problem was the installation, even the console application did not work with the same message.

* updating the project file with the output path
* running VS in administrator mode
* reference the Wealth Lab libraries
* in case of trouble shooting with the profile, checking the VS installation might help

These were the most important points for me so far. I still need some help.
Now, i do not know how to put the things together. This might be the lack of knowledge with C# or WL or the combination. Here is what i did.





The project is compiled and starts. The libraries are available in the WL directory. But the exception shows that the strategy name is not known. What do i miss or what do i wrong?
0
MIH8
- ago
#5
I tried something else but i still miss something essential.
I bet it is trivial, but i have no clue. Do I need to prepare something in WL?
And is the path correct: "C:\Program Files\Quantacula, LLC\WealthLab 8\x64\Debug\net6.0"

0
- ago
#6
Looks like your project is an executable whereas it should be a DLL:

https://www.wealth-lab.com/Support/ExtensionApi/StrategyLibrary
0
Glitch8
 ( 10.62% )
- ago
#7
Plus, the idea of using Visual Studio is to create a UserStrategyBase descendant that you could then run in WL8 as a compiled strategy, not using the StrategyRunner to run a Strategy. Although such a thing could work if it was coded into a proper WealthLab Extension library (DLL) that conforms to one of WL8's APIs.
0
MIH8
- ago
#8
Good point (@Eugene, overlapped with you Glitch), but there is a dll too. I was reading this article already.
I came to the conclusion that although there are some differences in the setup, the result is sufficient.

Differences I am talking about are WL7, output paths (exe file), .Net 3.1, and the two lines for the VS project file. One important point is the project type that is mentioned, "class library project" instead of the console application. The problem (i have/see) with selfstanding dll project is, that i can not run for itself. So, how would the test setup look like then?

Maybe the key is in this documentation, I could not see it so far.



As you can see beside the executable there is also the dll file.
My application tries to start the strategy, maybe this needs to be done in a different way?
0
MIH8
- ago
#9
@Glitch

I see the approach of mine is not meant that way.
Well, creating the dll with a dll project and deploying it accordingly should work.

I don't understand the big picture yet though. Now if I have this library deployed. How do I debug it then?
Where do I start the strategy and what do I need to configure in WL?
0
- ago
#10
Somewhat off topic, but WL7/8 is all 64-bit based. So the only platform you should be targeting is x64. Get rid of the AnyCPU part. There's no point in including 32-bit libraries in your builds.

CODE:
<PlatformTarget>x64</PlatformTarget> //<Platforms>AnyCPU;x64</Platforms> </PropertyGroup>
0
MIH8
- ago
#11
Ok, i got it. Everything is there already. Just started the strategy. I simply did not find it before.



1
MIH8
- ago
#12
Hi superticker.

Thanks for the hint, i already thought about that.
I did not touched it so far, because it was generated by VS.
I wanted to avoid more trouble than i already had.
1
MIH8
- ago
#13
After I have looked through the different links again, and now I also understand how the picture has to look like, there is probably one last barrier.



When I start the debugger I get the following message. I have not yet managed to adjust the correct settings for this.
Can anyone tell me where I can adjust these debugger settings in VS?
0
MIH8
- ago
#14
I already enabled this one.

0
MIH8
- ago
#15
0
- ago
#16
QUOTE:
Can anyone tell me where I can adjust these debugger settings in VS?

Did you know that for a modal Windows error dialog (like the one you get with those "CoreCLR-Runtime" messages) you could strike Ctrl-C to copy the underlying error message? That could help us translate to English and find the error (say on StackOverflow).
0
MIH8
- ago
#17
Hello Eugene, thanks for the hint. Of course i searched for the error message in the web. This is about a general error that occurs many times, in different contexts, but potential solutions did not help so far. Beside checking the preferences i checked the .Net components.

QUOTE:

A fatal error has occurred and debugging needs to be terminated. The debugger was configured to use the Desktop CLR (NET Framework) Managed debugger, but the target process loaded the CoreCLR (NET Core) runtime. To debug this project, configure it to use the 'Managed (CoreCLR)' debugger.


Now, i am curious how the preferences of other people look like with VS 2022 / WL8.

What I also have trouble with are the project files, or how they should look for a simple project.
Because here I could make also still manually appropriate entries, but for this I lack the experience in the given context.

I mean, everthing seems to be fine until i start the debugger with the given conflict.
0
- ago
#18
Sorry, I'm not familiar with this error message.

QUOTE:
I already enabled this one.

Checking "Enable native code debugging" is not necessary.
0
MIH8
- ago
#19
Just to finish it neatly. My problem was that I had selected the wrong project type.
Although creating the dll was possible, debugging was a problem with the above mentioned error.
All the previous steps worked when using the correct project type.
For people who are new to MS C# environment, the hint may be helpful.



2
Best Answer

Reply

Bookmark

Sort