Skip to content

Commit c4d9339

Browse files
committed
Set global PublishDir
1 parent 39c6fb8 commit c4d9339

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Core/Compiler/ProjectCompiler.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ namespace TestMyCode.CSharp.Core.Compiler
1313
{
1414
public class ProjectCompiler
1515
{
16+
private const string BIN_PATH = "bin";
17+
private const string OUTPUT_PATH = "output";
18+
1619
private readonly ProjectCollection ProjectCollection;
1720

1821
public ProjectCompiler()
1922
{
2023
this.ProjectCollection = new ProjectCollection();
24+
this.ProjectCollection.SetGlobalProperty("PublishDir", Path.Combine(ProjectCompiler.BIN_PATH, ProjectCompiler.OUTPUT_PATH));
2125
}
2226

2327
public ICollection<string> CompileTestProjects(string projectPath)
@@ -37,11 +41,10 @@ public ICollection<string> CompileTestProjects(string projectPath)
3741
throw new CompilationFaultedException(compilationErrors ?? Array.Empty<string>());
3842
}
3943

40-
string outputPath = project.GetPropertyValue("OutputPath").Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar); //Beautiful fix for directory separators
4144
string assemblyName = project.GetPropertyValue("AssemblyName");
4245

43-
string assemblyPath = Path.Combine(projectRoot, outputPath, $"{assemblyName}.dll");
44-
46+
string assemblyPath = Path.Combine(projectRoot, ProjectCompiler.BIN_PATH, ProjectCompiler.OUTPUT_PATH, $"{assemblyName}.dll");
47+
Console.WriteLine(assemblyPath);
4548
files.Add(assemblyPath);
4649
}
4750

0 commit comments

Comments
 (0)