Skip to content

Commit

Permalink
Add targets with common data and references
Browse files Browse the repository at this point in the history
  • Loading branch information
Platonymous committed Apr 4, 2021
1 parent c71f363 commit 501bdb2
Show file tree
Hide file tree
Showing 2 changed files with 261 additions and 0 deletions.
1 change: 1 addition & 0 deletions ValheimMods.sln
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
LICENSE.txt = LICENSE.txt
Mods.html = Mods.html
valheim.targets = valheim.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigurationManager", "ConfigurationManager\ConfigurationManager.csproj", "{104215E5-C277-4D43-A52C-B31467312299}"
Expand Down
260 changes: 260 additions & 0 deletions valheim.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<AssemblyName>$(ProjectName)</AssemblyName>
<RootNamespace>$(ProjectName)</RootNamespace>
<TargetFramework>net452</TargetFramework>
<Platforms>AnyCPU</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<GamePath><!-- Set GamePath manually --></GamePath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<!-- Find GamePath -->
<Choose>
<When Condition="($(OS) == 'Unix' OR $(OS) == 'OSX') AND $(GamePath) == ''">
<PropertyGroup>
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/.steam/steam/steamapps/common/Valheim</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/Library/Application Support/Steam/steamapps/common/Valheim/Contents/MacOS</GamePath>
</PropertyGroup>
</When>
<When Condition="($(OS) == 'Windows_NT') AND $(GamePath) == ''">
<PropertyGroup>
<GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 892970', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32))</GamePath>
<_SteamLibraryPath>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Valve\Steam', 'SteamPath', null, RegistryView.Registry32))</_SteamLibraryPath>
<GamePath Condition="!Exists('$(GamePath)') AND '$(_SteamLibraryPath)' != ''">$(_SteamLibraryPath)\steamapps\common\Valheim</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\Steam\steamapps\common\Valheim</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Valheim</GamePath>
</PropertyGroup>
</When>
</Choose>

<!-- Add BepInEx references -->
<ItemGroup Label="BepInEx">
<Reference Include="0Harmony20">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\BepInEx\core\0Harmony20.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BepInEx">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\BepInEx\core\BepInEx.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

<!-- Add valheim_data references -->
<ItemGroup Label="Valheim_Data">
<Reference Include="assembly_valheim">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_valheim.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="assembly_googleanalytics">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_googleanalytics.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="assembly_guiutils">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_guiutils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="assembly_postprocessing">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_postprocessing.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="assembly_steamworks">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_steamworks.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="assembly_sunshafts">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_sunshafts.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="assembly_utils">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\valheim_Data\Managed\assembly_utils.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

<!-- Add Unity references -->
<ItemGroup Label="Unity">
<Reference Include="UnityEngine">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AccessibilityModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.AccessibilityModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AIModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.AIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.AnimationModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.AudioModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ClothModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.ClothModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.InputLegacyModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.ParticleSystemModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.PhysicsModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ScreenCaptureModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.ScreenCaptureModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UIElementsModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.InputModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.JSONSerializeModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.ImageConversionModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TerrainModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.TerrainModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextCoreModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.TextCoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.TextRenderingModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UnityWebRequestModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestTextureModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.UnityWebRequestTextureModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(GamePath)\unstripped_corlib\UnityEngine.AssetBundleModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

<ItemGroup>
<Content Include="*.cfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<MainDLL Include="$(TargetDir)$(TargetName).dll" />
<AllCFG Include="$(TargetDir)**\*.cfg" />
</ItemGroup>

<!-- Copy to plugins folder and zip -->
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="@(MainDLL)" DestinationFolder="$(GamePath)\BepInEx\plugins\%(RecursiveDir)"></Copy>
<Copy SourceFiles="@(AllCFG)" DestinationFolder="$(GamePath)\BepInEx\plugins\%(RecursiveDir)"></Copy>
<Copy Condition="@(AditionalFiles) != ''" SourceFiles="@(AditionalFiles)" DestinationFolder="$(GamePath)\BepInEx\plugins\%(RecursiveDir)"></Copy>
<Delete Files="$(TargetDir)$(TargetName).zip" />
<Copy SourceFiles="@(MainDLL)" DestinationFolder="$(TargetDir)Release\%(RecursiveDir)"></Copy>
<Copy SourceFiles="@(AllCFG)" DestinationFolder="$(TargetDir)Release\%(RecursiveDir)"></Copy>
<Copy Condition="@(AditionalFiles) != ''" SourceFiles="@(AditionalFiles)" DestinationFolder="$(TargetDir)Release\%(RecursiveDir)"></Copy>
<ZipDirectory SourceDirectory="$(TargetDir)Release" DestinationFile="$(TargetDir)$(TargetName).zip" />
<RemoveDir Directories="$(TargetDir)Release" />
</Target>
</Project>

0 comments on commit 501bdb2

Please sign in to comment.