Is there a way to create an Artifact from the Script Console while running a c# script?
Thanks for getting in touch. You’re right, we didn’t provide any examples of collecting artifacts in C#. I’ve updated the artifacts documentation to include examples and more background on how we bootstrap your scripts in case that helps anyone else.
In your specific scenario, you can use the Script Console to run an ad-hoc script and collect artifacts from it using the
CreateArtifact method. For example:
Octopus.CreateArtifact(@"C:\Windows\System32\drivers\etc\hosts", System.Environment.MachineName + "-hosts.txt");
Please be aware that the
fileName parameter was recently added and shipped as part of Octopus 3.2.12.
Hope that helps!
This helps a ton! Thanks!