Lightrun for .NET Framework¶
To use Lightrun in a .NET Framework application:
- Open a terminal and change to the working directory where your project is located.
-
Install the .NET agent with the NuGet package manager.
dotnet add package Lightrun
-
Add the Lightrun agent to the top of your application’s main file. (i.e.,
Program.cs
file).using Lightrun
-
Add the following lines of code to the entry point of your application.
LightrunAgent.Start(new AgentOptions { Secret = "<LIGHTRUN_SECRET>", });
Getting Company Details
You can get your
<LIGHTRUN_SECRET>
key by logging into the Management Portal and inspecting the Set up an agent section.Note
Other configuration parameters can also be passed here. For example, add the
ServerUrl
parameter to theLightrun.Start
command when using Lightrun On-prem.LightrunAgent.Start(new AgentOptions { Secret = "<LIGHTRUN_SECRET>", ServerUrl = “<server_url>” });
-
Run your application.
Last update: May 29, 2023