A .NET Local Tools version of CopyDllsAfterBuild. It works on multi-platform, Windows, macOS and Linux without installing dependencies.
https://www.nuget.org/packages/CopyDllsAfterBuildLocalTools
Steps to use in your project.
- Step1. Install as .NET Local Tool.
dotnet new tool-manifest
dotnet tool install CopyDllsAfterBuildLocalToolTIPS: See Tutorial: Install and use .NET local tools - .NET CLI | Microsoft Docs for more details.
- Step2. Add PostBuild event to your csproj.
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="dotnet tool restore" />
<Exec Command="dotnet tool run dotnet-copydllsafterbuild run --project-dir $(ProjectDir) --target-dir $(TargetDir)" />
</Target>- Step3. Generate CopySettings.json on same directory of csproj.
TIPS: You can copy CopySettings.json from other project instead.
dotnet tool run dotnet-copydllsafterbuild initThis will output CopySettings.json template.
{
"destination": "../../project/Assets/Dlls",
"pattern": "*",
"excludes": [
"UnityEngine",
"UnityEditor"
],
"exclude_folders": []
}- Step4. (Optional) Modify CopySettings.json if needed. You can check json is valid via
validatecommand.
dotnet tool run dotnet-copydllsafterbuild validate- Step5. Run
dotnet buildwill work as like CopyDllsAfterBuild.
Yes, set COPYDLLS_LOGLEVEL env before running dotnet build.
Warning,Error,Criticalonly output if error happens.Informationjust output "Copy DLLs". (default)Debugoutput debug event log.Traceoutput detailed log.
COPYDLLS_LOGLEVEL=Debug && dotnet buildWindows users, use
set COPYDLLS_LOGLEVEL=Debug.
No, *.meta files exsisting on destination path will not be deleted via tool.
Yes, all file names except *.meta will be deleted.
Please move .gitignore file to outside destination.
Yes, you can install as .NET Global Tools.
dotnet tool install -g CopyDllsAfterBuildLocalTools --version 0.1.0
dotnet-copydllsafterbuild run --project-dir <ProjectDir> --target-dir <TargetDir>Yes, you can run with dotnet run.
dotnet run --framework net5.0 -- init
dotnet run --framework net5.0 -- validate
dotnet run --framework net5.0 -- run --project-dir <ProjectDir> --target-dir <TargetDir>