Skip to content

Commit

Permalink
Grab DS from Steam if game not found during build
Browse files Browse the repository at this point in the history
If a Steam install of SE can't be found, LinkBinaries.ps1 will try to download the DS binaries from Steam. Steam client is not required to do this. This only downloads the .DLL files, so it's reasonably fast.

For build performance, the DS binaries will not auto-update; execute this script with --Force to update the DS manually.

Synced .gitignore with root, and removed the one from project.

Make sure msbuild call restores nuget packages. Initialize the entire dev environment, if necessary, instead of just calling msbuild directly so the build-time environment is stable.
  • Loading branch information
Gwindalmir committed Sep 8, 2021
1 parent d83c3d1 commit dff52b2
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 285 deletions.
17 changes: 14 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Xx]64/
[Xx]86/
[Bb]uild/
bld/
[Bb]in/
[Oo]bj/
Expand Down Expand Up @@ -170,7 +171,10 @@ csx/
ecf/
rcf/

# Windows Store app package directories and files
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config

# Windows Store app package directory
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
Expand All @@ -184,6 +188,7 @@ _pkginfo.txt

# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
Expand Down Expand Up @@ -240,6 +245,10 @@ FakesAssemblies/
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# LightSwitch generated files
GeneratedArtifacts/
ModelManifest.xml

# Paket dependency manager
.paket/paket.exe
paket-files/
Expand All @@ -256,3 +265,5 @@ paket-files/
Bin64
.upgrade-assistant
launchSettings.json
DedicatedServer64
*[Dd]epot[Dd]ownloader*
5 changes: 4 additions & 1 deletion MEWorkshopTool/MEWorkshopTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="Bin64\**" />
<Compile Remove="DedicatedServer64\**" />
<EmbeddedResource Remove="Bin64\**" />
<EmbeddedResource Remove="DedicatedServer64\**" />
<None Remove="Bin64\**" />
<None Remove="DedicatedServer64\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="MedievalEngineers.Game">
Expand Down Expand Up @@ -81,7 +84,7 @@
<Import Project="..\WorkshopToolCommon\WorkshopToolCommon.projitems" Label="Shared" />
<Import Project="..\Updater\Updater.projitems" Label="Shared" />
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="set APPID=333950&#xD;&#xA;if NOT exist &quot;$(TargetDir)steam_appid.txt&quot; echo %APPID% &gt; &quot;$(TargetDir)steam_appid.txt&quot;&#xD;&#xA;powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(SolutionDir)\Tools\LinkBinaries.ps1 %APPID% $(TargetDir)\Bin64&#xD;&#xA;powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -Command &quot;&amp; {Compress-Archive -Force -Path $(TargetDir)$(TargetName).exe, $(TargetDir)$(TargetName).exe.config, $(TargetDir)$(TargetName).pdb, $(TargetDir)CommandLine.dll, $(TargetDir).wtignore -DestinationPath $(TargetDir)$(TargetName)-latest.zip}&quot;" />
<Exec Command="set APPID=333950&#xD;&#xA;if NOT exist &quot;$(TargetDir)steam_appid.txt&quot; echo %APPID% &gt; &quot;$(TargetDir)steam_appid.txt&quot;&#xD;&#xA;if NOT exist &quot;$(TargetDir)\Bin64&quot; mklink /j &quot;$(ProjectDir)\Bin64&quot; &quot;$(TargetDir)\Bin64&quot;&#xD;&#xA;powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -Command &quot;&amp; {Compress-Archive -Force -Path $(TargetDir)$(TargetName).exe, $(TargetDir)$(TargetName).exe.config, $(TargetDir)$(TargetName).pdb, $(TargetDir)CommandLine.dll, $(TargetDir).wtignore -DestinationPath $(TargetDir)$(TargetName)-v$(VersionPrefix).zip}&quot;" />
</Target>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(SolutionDir)\Tools\LinkBinaries.ps1 333950 $(ProjectDir)\Bin64" />
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ Please note, this is a command-line application only. A GUI may be considered in
> If you are not interested in building this from source, skip ahead to [Installation](#installation).
## Requirements
* A copy of [Space](https://store.steampowered.com/app/244850) (or [Medieval](https://store.steampowered.com/app/333950)) Engineers on Steam
* [Visual Studio Community 2017](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2017-and-other-products) 15.7 or higher
* [Build Tools for Visual Studio 2017](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2017-and-other-products) 15.7 or higher as an command-line alternative to VS.
* [Build Tools for Visual Studio 2017](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2017-and-other-products) 15.7 or higher at a *minimum*.
* Or the full [Visual Studio Community 2017](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2017-and-other-products) 15.7 or higher, if preferred instead
* JetBrains Rider is reported as working by the community as another alternative
* .NET Framework 4.6.1 Targeting Pack for Visual Studio, or the [Developer Pack](https://dotnet.microsoft.com/download/dotnet-framework/net461) if using the Build Tools
* SE targets this version
* [.NET Core SDK 2.1.300](https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300) or higher

### Optional
* A copy of [Space](https://store.steampowered.com/app/244850) (or [Medieval](https://store.steampowered.com/app/333950)) Engineers on Steam
* If either Steam or the game aren't found, the binaries will be downloaded from the Dedicated Server depot.
* A purchased copy of the game is still required to *run* the workshop tool, but not to build it.

## Build steps
These steps refer to Space Engineers. If you are working with Medieval Engineers, just subsititute as appropriate.
1. Clone repository.
Expand All @@ -27,7 +31,7 @@ These steps refer to Space Engineers. If you are working with Medieval Engineers
* If Steam and Space Engineers (or Medieval) are installed, they should be detected during the build and the project references to the game DLLs should automatically update. If not, you will need to manually create the junction. If there is a problem, the error message in the build output will explain how to create that manually.
* Select **Release**, **Any CPU**, and build the solution.
1. If using the Build Tools, or don't want to open the IDE
* Execute [**build.bat**](build.bat)
* Execute [**build.bat**](build.bat) (Double click, or run from a command prompt)
1. Copy the following files into the Space Engineers *Bin64* directory above: *SEWorkshopTool.exe*, *SEWorkshopTool.exe.config*, *CommandLine.dll*, and *steam_appid.txt*.
* Alternatively, just grab *SEWorkshopTool-latest.zip* in the output folder, and extract that to the Bin64 directory.
1. Open a command prompt in the Space Engineers *Bin64* directory as used above.
Expand Down
245 changes: 0 additions & 245 deletions SEWorkshopTool/.gitignore

This file was deleted.

5 changes: 4 additions & 1 deletion SEWorkshopTool/SEWorkshopTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="Bin64\**" />
<Compile Remove="DedicatedServer64\**" />
<EmbeddedResource Remove="Bin64\**" />
<EmbeddedResource Remove="DedicatedServer64\**" />
<None Remove="Bin64\**" />
<None Remove="DedicatedServer64\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="EmptyKeys.UserInterface.Core">
Expand Down Expand Up @@ -110,6 +113,6 @@
<Exec Command="powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(SolutionDir)\Tools\LinkBinaries.ps1 244850 $(ProjectDir)\Bin64" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="set APPID=244850&#xD;&#xA;if NOT exist &quot;$(TargetDir)steam_appid.txt&quot; echo %APPID% &gt; &quot;$(TargetDir)steam_appid.txt&quot;&#xD;&#xA;powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(SolutionDir)\Tools\LinkBinaries.ps1 244850 $(TargetDir)\Bin64&#xD;&#xA;powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -Command &quot;&amp; {Compress-Archive -Force -Path $(TargetDir)$(TargetName).exe, $(TargetDir)$(TargetName).exe.config, $(TargetDir)$(TargetName).pdb, $(TargetDir)CommandLine.dll, $(TargetDir).wtignore, $(TargetDir)steam_appid.txt -DestinationPath $(TargetDir)$(TargetName)-latest.zip}&quot;" />
<Exec Command="set APPID=244850&#xD;&#xA;if NOT exist &quot;$(TargetDir)steam_appid.txt&quot; echo %APPID% &gt; &quot;$(TargetDir)steam_appid.txt&quot;&#xD;&#xA;if NOT exist &quot;$(TargetDir)\Bin64&quot; mklink /j &quot;$(ProjectDir)\Bin64&quot; &quot;$(TargetDir)\Bin64&quot;&#xD;&#xA;powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -Command &quot;&amp; {Compress-Archive -Force -Path $(TargetDir)$(TargetName).exe, $(TargetDir)$(TargetName).exe.config, $(TargetDir)$(TargetName).pdb, $(TargetDir)CommandLine.dll, $(TargetDir).wtignore, $(TargetDir)steam_appid.txt -DestinationPath $(TargetDir)$(TargetName)-v$(VersionPrefix).zip}&quot;" />
</Target>
</Project>

0 comments on commit dff52b2

Please sign in to comment.