public Task ExecuteScriptAsync(string packageInstallPath, string scriptRelativePath, ZipArchive packageZipArchive, NuGetProject nuGetProject)
        {
            var scriptFullPath = Path.Combine(packageInstallPath, scriptRelativePath);

            if (!File.Exists(scriptFullPath))
            {
                throw new InvalidOperationException(scriptRelativePath + " was not found. Could not execute PS script");
            }

            int runCount;

            if (!ScriptsExecuted.TryGetValue(scriptRelativePath, out runCount))
            {
                ScriptsExecuted.Add(scriptRelativePath, 0);
            }

            ScriptsExecuted[scriptRelativePath]++;
            return(Task.FromResult(0));
        }
Ejemplo n.º 2
0
        public Task ExecuteScriptAsync(PackageIdentity identity, string packageInstallPath, string scriptRelativePath, bool throwOnFailure)
        {
            var scriptFullPath = Path.Combine(packageInstallPath, scriptRelativePath);

            if (!File.Exists(scriptFullPath) && throwOnFailure)
            {
                throw new InvalidOperationException(scriptRelativePath + " was not found. Could not execute PS script");
            }

            int runCount;

            if (!ScriptsExecuted.TryGetValue(scriptRelativePath, out runCount))
            {
                ScriptsExecuted.Add(scriptRelativePath, 0);
            }

            ScriptsExecuted[scriptRelativePath]++;
            return(Task.FromResult(0));
        }