Skip to content

Instantly share code, notes, and snippets.

@AldeRoberge
Created November 14, 2024 19:26
Show Gist options
  • Save AldeRoberge/266d9e6390798aeb6d9aa572f3da15e7 to your computer and use it in GitHub Desktop.
Save AldeRoberge/266d9e6390798aeb6d9aa572f3da15e7 to your computer and use it in GitHub Desktop.
Copy DLLs into Unity Library folder
<!-- To following is useful if you need to copy built .DLLs into Unity. -->
<!-- Adapt this script depending on where you want your DLLs copied. -->
<!-- You might need to manually add dependencies (other DLLs) inside of the folder. -->
<!-- You can check out NuGet For Unity for this, or simply build the libs with .NET Framework 2.1 and import them. -->
<!-- -->
<!-- Example -->
<!-- -->
<!-- ADG -->
<!-- ├── ADG.FMOD -->
<!-- ├── ADG.Unity -->
<!-- │ └── Assets -->
<!-- │ └── Generator -->
<!-- │ └── Plugins -->
<!-- │ └── Library -->
<!-- └── ADG.Library -->
<!-- ├── ADG.Server -->
<!-- ├── ADG.Shared* -->
<!-- └── ADG.Client -->
<!-- -->
<!-- * is the current .csproj -->
<Project Sdk="Microsoft.NET.Sdk">
<!-- ... -->
<Target Name="Copy to Unity" AfterTargets="PostBuildEvent">
<PropertyGroup>
<UnityFolder>..\..\ADG-Unity\Assets\Generator\Plugins\Library</UnityFolder>
</PropertyGroup>
<ItemGroup>
<DllFiles Include="$(OutDir)$(AssemblyName).dll;"/>
</ItemGroup>
<!-- Copy the DLL to the Unity folder -->
<Message Text="Copying $(OutDir)$(AssemblyName).dll to $(UnityFolder)" Importance="high"/>
<Copy SourceFiles="@(DllFiles)" DestinationFolder="$(UnityFolder)"/>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment