Class DotNetWrapper

All Implemented Interfaces:
ExtensionPoint, Describable<BuildWrapper>

public class DotNetWrapper extends SimpleBuildWrapper
A .NET build wrapper, for .NET pipeline steps. This makes a .NET SDK available during a specific script section.
  • Constructor Details

    • DotNetWrapper

      @DataBoundConstructor public DotNetWrapper()
      Creates a new .NET wrapper.
  • Method Details

    • getSdk

      @CheckForNull public String getSdk()
      Gets the name of the SDK that this wrapper will make available.
      Returns:
      The name of the SDK that this wrapper will make available, or null if none was set (which will cause a runtime exception if the wrapper gets used).
    • setSdk

      @DataBoundSetter public void setSdk(@CheckForNull String sdk)
      Sets the name of the SDK that this wrapper will make available.
      Parameters:
      sdk - The name of the SDK to make available.
    • isSpecificSdkVersion

      public boolean isSpecificSdkVersion()
      Determines whether this .NET wrapper will enforce a specific SDK version.

      This mainly matters for Windows agents that have an SDK installed at the system level. Some SDK versions will always run the most recent SDK version available on the system; with this set, a global.json file will be created to ensure a specific SDK version gets used.

      Returns:
      true when global.json will be used to ensure a specific SDK version gets used; false otherwise.
    • setSpecificSdkVersion

      @DataBoundSetter public void setSpecificSdkVersion(boolean specificSdkVersion)
      Determines whether this .NET wrapper should enforce a specific SDK version.

      This mainly matters for Windows agents that have an SDK installed at the system level. Some SDK versions will always run the most recent SDK version available on the system; with this set, a global.json file will be created to ensure a specific SDK version gets used.

      Parameters:
      specificSdkVersion - true if global.json should be used to ensure a specific SDK version gets used; false otherwise.
    • setUp

      public void setUp(@NonNull SimpleBuildWrapper.Context context, @NonNull Run<?,?> build, @NonNull FilePath workspace, @NonNull Launcher launcher, @NonNull TaskListener listener, @NonNull EnvVars initialEnvironment) throws IOException, InterruptedException
      Sets up the .NET wrapper.

      This will ensure that a valid SDK is specified, then extends the environment with the SDK's variables. If requested, it will also set up a global.json (and arrange for it to be cleaned up when the wrapper ends).

      Overrides:
      setUp in class SimpleBuildWrapper
      Parameters:
      context - The context the wrapper is run in.
      build - The build in which this wrapper is being run.
      workspace - The workspace in which the wrapper is being activated.
      launcher - The launcher the wrapper can use to execute programs, if needed.
      listener - The listener for the build.
      initialEnvironment - The initial environment for the wrapper.
      Throws:
      IOException
      InterruptedException
    • createLoggerDecorator

      @CheckForNull public ConsoleLogFilter createLoggerDecorator(@NonNull Run<?,?> build)
      Creates a new logger decorator for the wrapper.
      Overrides:
      createLoggerDecorator in class SimpleBuildWrapper
      Parameters:
      build - The build in which this wrapper is being run.
      Returns:
      A new DiagnosticFilter instance.