8000 GitHub - eas-solutions/TestDebugScript: Beispiel für die Verwendung der DebugScript.dll um Skripte innerhalb von Visual Studio debuggen zu können.
[go: up one dir, main page]

Skip to content

Beispiel für die Verwendung der DebugScript.dll um Skripte innerhalb von Visual Studio debuggen zu können.

Notifications You must be signed in to change notification settings

eas-solutions/TestDebugScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using DebugScript in Microsoft Visual Studio

Roundup

This is a demonstration of how to run LEEGOO BUILDER from Visual Studio (or Visual Studio Code) to use it's debugger and to have the ability to set breakpoints to simplify script development.

Getting Started

This Project can be found on GitHub.

url: https://github.com/eas-solutions/TestDebugScript

It is recommended to create a fork of this repository and store it in your own private repository on GitHub.

Requirements

The following requirements must be met.

  • A working installation of an up to date version of LEEGOO BUILDER G3
  • MS Visual Studio 2022 or another development environment
  • (optional) a personal GitHub account

Adjustments

There are several things to be adjusted to make this project working on a developers machine.

1. References

Add a Reference to the current version of DynamicEntities_*.dll.
You find the correct assembly in the "LocalAssemblyCache" folder, typically at this location:
c:\Users\<YourUserName>\AppData\Roaming\LB.Net\LeegooBuilder.LAC\<CurrentLeegooBuilderVersion>\<UsedDataBaseName>@<HostName>\Environment\
Reference the latest file in this folder wich file matches DynamicEntities_*.dll.

1.1 (Visual Studio Code only) launch.json

When using VSCode for debugging building and executing the script file will use the .vscode\launch.json to start LEEGOO BUILDER. The file assumes that the LEEGOO binaries are located in the Leegoo folder of the repository. To adjust the location of the LEEGOO binaries the following entries need to be edited:

"program": "${workspaceFolder}\\Leegoo\\EAS.LeegooBuilder.Client.GUI.Shell.exe",
"cwd": "${workspaceFolder}\\Leegoo",

2. Change several namings

Change the following file names according to your requirements:

  • TestDebugScript.csproj
  • TestDataExport.cs

Do not forget to update the namespaces.

3. Source Code Adjustments

3.1 TestDebugScript.csproj

Open TestPlugIn.csproj and change the following nodes according to your requirements:

  • <TargetFramework>
  • <UseWpf>
  • <OutputPath>
  • <AssemblyName>
  • <RootNamespace>

OutputPath should point to your binaries folder (where EAS.LeegooBuilder.Client.GUI.Shell.exe is located).

3.2 AssemblyInfo.cs

Open AssemblyInfo.cs and update all relevant attributes.

[assembly: AssemblyTitle("TestDebugScript")]
[assembly: AssemblyDescription("Exsample of using DebugScript for LEEGOO BUILDER G3")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("EAS")]
[assembly: AssemblyProduct("TestDebugScript")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
...
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Try to compile the project. No errors should occur.

LEEGOO BUILDER integration

LEEGOO BUILDER needs to be configured to load this assembly.
Go to the binaries folder (see above) and open script.json.
Add the following nodes.

{
  "ExternalAssemblies": [
    {
      "AssemblyName": "EAS.LeegooBuilder.Server.DebugScript.dll",
      "Description": "DebugScript"
    },
    {
      "AssemblyName": "EAS.LeegooB
63E5
uilder.Server.DebugScript.TestExport.dll",
      "Description": "TestExport using DebugScript"
    }
  ],
  "AdditionalUsings": [
    {
      "Name": "EAS.LeegooBuilder.Server.DebugScript",
      "Description": "DebugScript"
    },
    {
      "Name": "EAS.LeegooBuilder.Server.DebugScript.TestExport",
      "Description": "TestExport using DebugScript"
    }
  ]
}

Sample script to call your assembly

Start LEEGOO BUILDER and go to the script editor, create a new script and replace the source code with the following source code:

public override object Main(CustomScriptArgs args)
{
    var scriptDebugAssembly = new TestExportData(ScriptContext, "Alfred E. Neumann");
    scriptDebugAssembly.HelloWorld();
    WriteLine($"return value of GetYourName(): {scriptDebugAssembly.GetYourName()}");
    WriteLine($"return value of TestEntityFramework(): {scriptDebugAssembly.TestEntityFramework()}");
	
    return null;
}

Set a breakpoint in your development environment e.g. at TestExportData.HelloWorld() and start the script. Visual Studio should stop at the breakpoint.

Take a look at the displayed messagebox and the output window underneath the source code.

About

Beispiel für die Verwendung der DebugScript.dll um Skripte innerhalb von Visual Studio debuggen zu können.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0