Skip to content

Commit 56d9920

Browse files
committed
feat: adding alternative for single file publish
1 parent 8260134 commit 56d9920

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ If you want to change the configured properties before loading or compiling the
119119

120120
Be careful though, you may break the ability to load, compile, or interpret the project if you change the MSBuild properties.
121121

122+
123+
## Publish SingleFile
124+
If your application's output is a single file, you will need to provide the path to the following DLLs:
125+
126+
-MsBuildPipeLogger.Logger.dll
127+
-Buildalyzer.logger.dll
128+
129+
Variable name: LoggerPathDll
130+
131+
See related issue [224](https://github.com/phmonte/Buildalyzer/issues/224)
132+
msbuild needs the physical address of the logger, for this reason it is not possible to use single file publish without informing this route.
133+
134+
Remembering that if the files are in the root where the project is running, it is not necessary to inform the path.
122135
## Binary Log Files
123136

124137
Buildalyzer can also read [MSBuild binary log files](http://msbuildlog.com/):

src/Buildalyzer/Environment/EnvironmentVariables.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ public static class EnvironmentVariables
1414
public const string MSBUILDDISABLENODEREUSE = nameof(MSBUILDDISABLENODEREUSE);
1515
public const string MSBuildExtensionsPath = nameof(MSBuildExtensionsPath);
1616
public const string MSBuildSDKsPath = nameof(MSBuildSDKsPath);
17+
public const string LoggerPathDll = nameof(LoggerPathDll);
1718
}

src/Buildalyzer/ProjectAnalyzer.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ private string GetCommand(
279279
}
280280

281281
// Get the logger arguments (/l)
282-
string loggerPath = typeof(BuildalyzerLogger).Assembly.Location;
282+
string loggerPath = GetLoggerPath();
283+
283284
bool logEverything = _buildLoggers.Count > 0;
284285
string loggerArgStart = "/l"; // in case of MSBuild.exe use slash as parameter prefix for logger
285286
if (isDotNet)
@@ -312,6 +313,23 @@ private string GetCommand(
312313
return fileName;
313314
}
314315

316+
private static string GetLoggerPath()
317+
{
318+
string loggerPath = typeof(BuildalyzerLogger).Assembly.Location;
319+
if (!string.IsNullOrEmpty(loggerPath))
320+
{
321+
return loggerPath;
322+
}
323+
324+
string? loggerDllPathEnv = System.Environment.GetEnvironmentVariable(Environment.EnvironmentVariables.LoggerPathDll);
325+
if (string.IsNullOrEmpty(loggerDllPathEnv))
326+
{
327+
throw new ArgumentException($"The dll of {nameof(BuildalyzerLogger)} is required");
328+
}
329+
330+
return loggerDllPathEnv;
331+
}
332+
315333
private static string FormatArgument(string argument)
316334
{
317335
// Escape inner quotes

0 commit comments

Comments
 (0)