本文整理汇总了C#中IExecutionContext.ExecuteScript方法的典型用法代码示例。如果您正苦于以下问题:C# IExecutionContext.ExecuteScript方法的具体用法?C# IExecutionContext.ExecuteScript怎么用?C# IExecutionContext.ExecuteScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExecutionContext
的用法示例。
在下文中一共展示了IExecutionContext.ExecuteScript方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecutePowerShellScriptIfPresent
public static void ExecutePowerShellScriptIfPresent(string scriptName, InstallationTarget target, IPackage package, string installPath, IExecutionContext context)
{
Debug.Assert(context != null);
// If we don't have a project, we're at solution level
// The <Solution> string is only for tracing so it probably doesn't need to be loc'ed
string projectName = target.Name;
var targetFramework = target.GetSupportedFrameworks().FirstOrDefault();
// Get the install script
var scriptFile = FindScript(
package,
scriptName,
targetFramework);
// If there is a script to run
if (scriptFile != null)
{
NuGetTraceSources.ActionExecutor.Info(
"executingps1",
"[{0}] Running {2} for {1}",
projectName,
package.GetFullName(),
scriptFile.Path);
context.ExecuteScript(installPath, scriptFile.Path, package, target);
}
else
{
NuGetTraceSources.ActionExecutor.Info(
"nops1",
"[{0}] No {2} script for {1}.",
projectName,
package.GetFullName(),
scriptName);
}
}