The SeaLights dotnet
Table of Contents |
---|
The SeaLights .NET agent can be integrated with MSBuild to scan the binary code and provide the SeaLights server with the build information.
Generating a session ID
Before running the build scan and tests, you need to create a session ID. The session ID is provided to for each step in order to link them together as one complete cycle
Code Block | ||||
---|---|---|---|---|
| ||||
SL.DotNet.exe config --tokenFile C:\path\to\sltoken.txt --appName "myApp" --branchName "master" --buildName "1"$(Get-Date -Format "yyyyMMdd_HHmm") --includeNamespace myNameSpace.* [--excludeNamespace <arg>] [--include <arg>] [--exclude <arg>] [--buildSessionId <arg> | --buildSessionIdFile <arg>] [--proxy <arg>]buildSessionIdFile buildSessionId.txt |
Automatic setup
TheSeaLights The SeaLights agent can automatically setup set up your msbuild MSBuild to work with the SeaLights agent.
Code Block | ||
---|---|---|
| ||
SL.DotNet.exe prepareForMsBuild --tokenFile C:\path\to\sltoken.txt --buildSessionIdFile buildSessionId.txt --workspacePath "C:\path\to\project" --baseDir "C:\path\to\project" --ignoreGeneratedCode true --msBuildVersion 15 --logEnabled true |
This command creates a file called 'after.{SOLUTION_FILE_NAME}.targets
' which sits alongside your solution file with all the needed parameters in it forfor the Sealights agent to be executed automatically by MSBuild.
Info |
---|
See SeaLights .NET - command reference for full parameter details. |
Run MSbuild
When running MSBuild, it will identify the above file and cause our agent to come up and report the details needed from the binary files.
Code Block | ||||
---|---|---|---|---|
| ||||
Msbuild SlnFolders.sln /t:rebuild |
Note |
---|
As SeaLights is using the compilation method's bytecode signature (Hash ID) to generate a unique identifier for each method, it is important NOT to recompile the application between the scan command and the deployment. The scanned build's artefact (DLL, EXE) MUST be from the exact same compilation as the one deployed. |
In certain cases, integrating our agent as part of MSBuild
causes the build to fail with 'Error MSB4025: The project file could not be loaded. Could not find file ... .metaproj
' message. Please refer to our dedicated troubleshooting article for resolution.