Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
seayxu committed Dec 21, 2023
1 parent 45eb3f0 commit b23bc6f
Showing 1 changed file with 69 additions and 69 deletions.
138 changes: 69 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Use [Obfuscar.GlobalTool](https://www.nuget.org/packages/Obfuscar.GlobalTool) to
### Install Obfuscar.GlobalTool

Global installation:
```bash
dotnet tool install --global Obfuscar.GlobalTool --version 2.2.38
```
```bash
dotnet tool install --global Obfuscar.GlobalTool --version 2.2.38
```

Local installation:
```bash
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Obfuscar.GlobalTool --version 2.2.38
```
```bash
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Obfuscar.GlobalTool --version 2.2.38
```

### Install Hsu.Obfuscar.DotNetTool

Expand All @@ -38,72 +38,72 @@ See [NuGet](https://www.nuget.org/packages/Hsu.Obfuscar.DotNetTool).
### Configuration

- Add `AssemblySearchPath` file:
```csharp
<PropertyGroup>
<ObfuscarAssembliesInclude>true</ObfuscarAssembliesInclude>
</PropertyGroup>
```

When you build the project, the `obfuscar.xml` file and `obfuscar.assemblies[-fw].xml` will be created to the `.obfuscar` folder.
```csharp
<PropertyGroup>
<ObfuscarAssembliesInclude>true</ObfuscarAssembliesInclude>
</PropertyGroup>
```

When you build the project, the `obfuscar.xml` file will be created to the root folder of project and `obfuscar.assemblies.xml` will be created to the output folder of project.

- Default `obfuscar.xml` contents
```xml
<?xml version="1.0"?>
<Obfuscator>
<!-- https://docs.obfuscar.com/getting-started/configuration -->
<!-- https://github.com/obfuscar/obfuscar/blob/master/Obfuscar/Settings.cs -->

<Var name="InPath" value="." />
<Var name="OutPath" value=".\obfuscated" />
<Var name="RenameFields" value="true" />
<Var name="RenameProperties" value="true" />
<Var name="RenameEvents" value="true" />
<Var name="KeepPublicApi" value="true" />
<Var name="HidePrivateApi" value="true" />
<Var name="ReuseNames" value="true" />
<Var name="UseUnicodeNames" value="false" />
<Var name="UseKoreanNames" value="false" />
<Var name="HideStrings" value="false" />
<Var name="OptimizeMethods" value="true" />
<Var name="SuppressIldasm" value="false" />

<Module file="ConsoleSample.dll">
<SkipEnums value="true" />
</Module>
```xml
<?xml version="1.0"?>
<Obfuscator>
<!-- https://docs.obfuscar.com/getting-started/configuration -->
<!-- https://github.com/obfuscar/obfuscar/blob/master/Obfuscar/Settings.cs -->

<Var name="InPath" value="." />
<Var name="OutPath" value="obfuscated" />
<Var name="RenameFields" value="true" />
<Var name="RenameProperties" value="true" />
<Var name="RenameEvents" value="true" />
<Var name="KeepPublicApi" value="true" />
<Var name="HidePrivateApi" value="true" />
<Var name="ReuseNames" value="true" />
<Var name="UseUnicodeNames" value="false" />
<Var name="UseKoreanNames" value="false" />
<Var name="HideStrings" value="false" />
<Var name="OptimizeMethods" value="true" />
<Var name="SuppressIldasm" value="false" />

<!-- <Include path="obfuscar.assemblies.xml" /> -->
<Include path="obfuscar.assemblies.xml" />
</Obfuscator>
```

- Default `obfuscar.assemblies[-fw].xml` contents
```xml
<?xml version="1.0"?>
<Include>
<AssemblySearchPath path='.' />
</Include>
```

You can also modify the `obfuscar.xml` and `obfuscar.assemblies[-fw].xml` file to change the default values.

### Generated files

- Single framework

```config
-- .obfuscar
|-- obfuscar.xml
|-- obfuscar.assemblies.xml
```

- Multiple framework
```config
-- .obfuscar
|-- obfuscar.xml
|-- obfuscar.assemblies-net462.xml
|-- obfuscar.assemblies-net6.0.xml
|-- obfuscar.assemblies-net8.0.xml
```
<Module file="ConsoleSample.dll">
<SkipEnums value="true" />
</Module>

<!-- <Include path="obfuscar.assemblies.xml" /> -->
<Include path="obfuscar.assemblies.xml" />
</Obfuscator>
```

- Default `obfuscar.assemblies.xml` contents
```xml
<?xml version="1.0"?>
<Include>
<AssemblySearchPath path='.' />
</Include>
```

You can also modify the `obfuscar.xml` file to change the default values.

You can also modify the `AssemblySearchNames` property will auto gen `AssemblySearchPath` in `obfuscar.assemblies.xml` file.

- AssemblySearchNames
```csharp
<PropertyGroup>
<AssemblySearchNames>Microsoft.CodeAnalysis.dll;Microsoft.CodeAnalysis.CSharp.dll</AssemblySearchNames>
</PropertyGroup>
```

- `obfuscar.assemblies.xml`
```xml
<?xml version="1.0"?>
<Include>
<AssemblySearchPath path='C:\Users\Administrator\.nuget\packages\microsoft.codeanalysis.csharp\4.7.0\lib\netstandard2.0' />
<AssemblySearchPath path='C:\Users\Administrator\.nuget\packages\microsoft.codeanalysis.common\4.7.0\lib\netstandard2.0' />
</Include>
```

## License
MIT

0 comments on commit b23bc6f

Please sign in to comment.