Skip to content

Commit

Permalink
Merge pull request #1212 from Measurity/client-lib-folder
Browse files Browse the repository at this point in the history
Changed launcher build to put dll dependencies in lib folder
  • Loading branch information
Sunrunner37 authored Aug 9, 2020
2 parents 5b0b6a0 + 4da3a77 commit 07a538a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Nitrox.Bootloader/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEve
}

// Load DLLs where Nitrox launcher is first, if not found, use Subnautica's DLLs.
string dllPath = Path.Combine(nitroxLauncherDir.Value, dllFileName);
string dllPath = Path.Combine(nitroxLauncherDir.Value, "lib", dllFileName);
if (!File.Exists(dllPath))
{
dllPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), dllFileName);
Expand Down
2 changes: 1 addition & 1 deletion NitroxLauncher/LauncherLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ internal async Task StartMultiplayerAsync()
string bootloaderName = "Nitrox.Bootloader.dll";
try
{
File.Copy(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), bootloaderName), Path.Combine(subnauticaPath, "Subnautica_Data", "Managed", bootloaderName), true);
File.Copy(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lib", bootloaderName), Path.Combine(subnauticaPath, "Subnautica_Data", "Managed", bootloaderName), true);
}
catch (IOException)
{
Expand Down
16 changes: 14 additions & 2 deletions NitroxLauncher/NitroxLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,22 @@
TODO: Try fix this as a project reference to Nitrox.Subnautica.Assets that will copy the files on build automatically. -->
<Target Name="MoveNitroxAssetsToLauncherOutput" AfterTargets="Build" Condition="'$(OS)' == 'Windows_NT'">
<ItemGroup>
<NitroxSubnauticaAssets Include="..\Nitrox.Subnautica.Assets\**\*.dll" />
<NitroxSubnauticaAssets Include="..\Nitrox.Subnautica.Assets\**\*." />
</ItemGroup>
<ItemGroup>
<NitroxSubnauticaStaticDlls Include="..\Nitrox.Subnautica.Assets\**\*.dll" />
</ItemGroup>
<Copy SourceFiles="@(NitroxSubnauticaAssets)" DestinationFolder="$(TargetDir)\%(RecursiveDir)" />
<Copy SourceFiles="@(NitroxSubnauticaStaticDlls)" DestinationFolder="$(TargetDir)\lib\%(RecursiveDir)" />
</Target>
<Target Name="MoveDependenciesToLib" AfterTargets="Build">
<ItemGroup>
<AllDependencies Include="$(TargetDir)*.dll" />
<AllDependencies Include="$(TargetDir)*.pdb" />
<AllDependencies Include="$(TargetDir)*.dll.config" />
<AllDependencies Include="$(TargetDir)*.xml" />
</ItemGroup>
<Move SourceFiles="@(AllDependencies)" DestinationFolder="$(TargetDir)lib" />
</Target>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="'$(OS)' == 'Windows_NT'" />
</Project>
</Project>
1 change: 1 addition & 0 deletions NitroxServer-Subnautica/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
<dependentAssembly>
<assemblyIdentity name="Mono.Cecil" publicKeyToken="50cebf1cceb9d05e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.11.2.0" newVersion="0.11.2.0" />
Expand Down
2 changes: 1 addition & 1 deletion NitroxServer-Subnautica/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEve
}

// Load DLLs where this program (exe) is located
string dllPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), dllFileName);
string dllPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "lib", dllFileName);
if (!File.Exists(dllPath))
{
// Try find game managed libraries
Expand Down

0 comments on commit 07a538a

Please sign in to comment.