Skip to content

Commit

Permalink
Fixed dotnet tool issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
seayxu committed Mar 4, 2024
1 parent b23bc6f commit 26eeae9
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
BeforeTargets="Restore">
<Exec
Condition="'$(ObfuscarBuild)' == 'true' and '$(ObfuscarGlobalToolRestored)'=='false'"
ConsoleToMsBuild="true"
UseUtf8Encoding="Always"
Command="dotnet tool restore">
</Exec>
Expand All @@ -16,14 +15,21 @@

<!-- check tool -->
<Target Name="_ObfuscarGlobalToolCheckPrerequisites">
<PropertyGroup>
<ObfuscarGlobalToolLocalCheckOutput>''</ObfuscarGlobalToolLocalCheckOutput>
</PropertyGroup>
<!-- check local -->
<Exec
ConsoleToMsBuild="true"
UseUtf8Encoding="Always"
IgnoreExitCode="true"
Command="dotnet tool list Obfuscar.GlobalTool">
<Output TaskParameter="ConsoleOutput" PropertyName="ObfuscarGlobalToolLocalCheckOutput"/>
<Output TaskParameter="ExitCode" PropertyName="ObfuscarGlobalToolLocalCheckOutput"/>
</Exec>
<PropertyGroup Condition="$(ObfuscarGlobalToolLocalCheckOutput.IndexOf('obfuscar.console')) != -1">
<Message
Text="ObfuscarGlobalToolLocalCheckOutput:'$(ObfuscarGlobalToolLocalCheckOutput)'"
Importance="high"
/>
<PropertyGroup Condition="$(ObfuscarGlobalToolGlobalCheckOutput) == 0">
<ObfuscarGlobalToolExists>1</ObfuscarGlobalToolExists>
</PropertyGroup>
<Message
Expand All @@ -35,12 +41,12 @@
<!-- check global -->
<Exec
Condition="$(ObfuscarGlobalToolExists) != 1"
ConsoleToMsBuild="true"
UseUtf8Encoding="Always"
IgnoreExitCode="true"
Command="dotnet tool list -g Obfuscar.GlobalTool">
<Output TaskParameter="ConsoleOutput" PropertyName="ObfuscarGlobalToolGlobalCheckOutput"/>
<Output TaskParameter="ExitCode" PropertyName="ObfuscarGlobalToolGlobalCheckOutput"/>
</Exec>
<PropertyGroup Condition="$(ObfuscarGlobalToolGlobalCheckOutput.IndexOf('obfuscar.console')) != -1">
<PropertyGroup Condition="$(ObfuscarGlobalToolGlobalCheckOutput) == 0">
<ObfuscarGlobalToolExists>0</ObfuscarGlobalToolExists>
</PropertyGroup>
<Message
Expand Down Expand Up @@ -158,7 +164,7 @@
<ObfuscateCommand>obfuscar.console $(ObfuscarConfigName)</ObfuscateCommand>
</PropertyGroup>
<PropertyGroup Condition="$(ObfuscarGlobalToolExists) == 1">
<ObfuscateCommand>dotnet obfuscar.console $(ObfuscarConfigName)</ObfuscateCommand>
<ObfuscateCommand>dotnet run obfuscar.console $(ObfuscarConfigName)</ObfuscateCommand>
</PropertyGroup>
</Target>

Expand All @@ -179,6 +185,7 @@

<Exec
Condition="$(ObfuscarGlobalToolExists) == 1 or $(ObfuscarGlobalToolExists) == 0"
UseUtf8Encoding="Always"
WorkingDirectory="$(OutputPath)"
Command="$(ObfuscateCommand)"/>

Expand Down

0 comments on commit 26eeae9

Please sign in to comment.