Fix strange scripting errors.
This commit is contained in:
parent
035ab6e830
commit
fdbdf0ce62
4 changed files with 15 additions and 3 deletions
|
@ -696,7 +696,7 @@ public abstract class VSGenericTarget : ITarget
|
|||
string outputFile = Path.Combine(project.Path, node.OutputName);
|
||||
|
||||
ps.WriteLine(" <Target Name=\"Prebuild\" BeforeTargets=\"PreBuildEvent\">");
|
||||
ps.WriteLine($" <Exec Command=\"'dotnet' '$(ProjectDir){pathText}' '$(ProjectDir){node.Name}' '$(ProjectDir){node.OutputName}' '{node.Libraries}' \" />");
|
||||
ps.WriteLine($" <Exec Command='dotnet \"$(SolutionDir){pathText}\" \"$(ProjectDir){node.Name}\" \"$(ProjectDir){node.OutputName}\" \"{node.Libraries}\"' />");
|
||||
ps.WriteLine($" </Target>");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,16 +14,26 @@ namespace SnapWrap
|
|||
string output = args[1];
|
||||
var customImports = args[2].Split("..");
|
||||
|
||||
if (customImports.Length == 0) customImports = new string[3] { "System", "System.Diagnostics.Process", "System.IO" };
|
||||
|
||||
try
|
||||
{
|
||||
var inputCode = File.ReadAllText(input);
|
||||
|
||||
var options = ScriptOptions.Default
|
||||
.WithReferences(AppDomain.CurrentDomain.GetAssemblies()) // Add necessary assemblies
|
||||
.WithReferences(typeof(Process).Assembly,
|
||||
typeof(Console).Assembly
|
||||
)
|
||||
.WithOptimizationLevel(Microsoft.CodeAnalysis.OptimizationLevel.Release)
|
||||
.WithImports(customImports)
|
||||
.WithAllowUnsafe(true);
|
||||
|
||||
|
||||
Console.WriteLine("Run Script: " + input);
|
||||
Console.WriteLine("Script Length: " + inputCode.Length);
|
||||
|
||||
|
||||
// Capture console output using custom class
|
||||
using (var consoleOutput = new ConsoleOutput())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue