Skip to content

Commit 0c4e21f

Browse files
PiezPiedPyKSP-TaxiService
authored andcommitted
Improved default Visual Studio process (#753)
* .gitignore: Added VS2015+ cache * Build: Updated .csproj file Toolsversion updated to v12 Un-needed references removed. Full Debug symbols for Debug builds * Build: Removed hard-coded file paths and replaced with Env variable. Hard-coded file paths in VS proj file have been removed and replaced with an Environment variable $KSPDEVDIR. Allows contributors to have different locations for their development builds. * Build: Remove Trace directive from release builds * Build: Add build scripts for VS * Build: Add conditional for CI and change Language version to default
1 parent 79c052d commit 0c4e21f

12 files changed

+134
-16
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ build/
4646
*.log
4747
*.scc
4848

49+
# Visual Studio 2015 cache/options directory
50+
.vs/
51+
4952
# Visual C++ cache files
5053
ipch/
5154
*.aps

Diff for: CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,13 @@ When writing new code for RemoteTech, please follow the following steps:
7373
- If your code fixes a bug in RemoteTech, create a pull request to the `develop` branch (this should be the default).
7474
- If your code adds a new feature in RemoteTech, create a pull request to the branch of the next release (e.g., `1.7.0`; if no such branch exists, please contact us).
7575
* One of the Remote Technologies Group members will merge the pull request; if you yourself are a member, please wait one week to give others a chance to give feedback.
76+
77+
To make your life a little easier, the Visual Studio Project respects an environment variable called `KSPDEVDIR`.
78+
If you set its value to the path of your KSP install, the reference and build paths inside the project should be set automatically.
79+
If it is not set, your reference paths and the build paths have to be set manually.
80+
81+
To set the variable, follow the instructions in this link, before starting a Visual Studio instance:
82+
83+
https://superuser.com/a/949577
84+
85+

Diff for: buildscripts/UnityDebug/Mono.Cecil.dll

280 KB
Binary file not shown.
Binary file not shown.

Diff for: buildscripts/UnityDebug/PlayerConnectionConfigFile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
listen 4294967295 1 1

Diff for: buildscripts/UnityDebug/pdb2mdb.exe

60.5 KB
Binary file not shown.

Diff for: buildscripts/UnityDebug/prepare-debug.bat

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
rem Generate the MDB file needed by UnityVS and Monodevelop for debugging
2+
3+
@echo off
4+
5+
rem get parameters that are passed by visual studio post build event
6+
SET TargetName=%1
7+
8+
rem make sure the initial working directory is the one containing the current script
9+
SET scriptPath=%~dp0
10+
11+
echo Generating Unity Monodevelop Debug file...
12+
echo %TargetName%.dll -^> %TargetName%.dll.mdb
13+
"%scriptPath%\pdb2mdb.exe" %TargetName%.dll

Diff for: buildscripts/ZipPack/7za-License.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
7-Zip Extra
2+
~~~~~~~~~~~
3+
License for use and distribution
4+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5+
6+
Copyright (C) 1999-2016 Igor Pavlov.
7+
8+
7-Zip Extra files are under the GNU LGPL license.
9+
10+
11+
Notes:
12+
You can use 7-Zip Extra on any computer, including a computer in a commercial
13+
organization. You don't need to register or pay for 7-Zip.
14+
15+
16+
GNU LGPL information
17+
--------------------
18+
19+
This library is free software; you can redistribute it and/or
20+
modify it under the terms of the GNU Lesser General Public
21+
License as published by the Free Software Foundation; either
22+
version 2.1 of the License, or (at your option) any later version.
23+
24+
This library is distributed in the hope that it will be useful,
25+
but WITHOUT ANY WARRANTY; without even the implied warranty of
26+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27+
Lesser General Public License for more details.
28+
29+
You can receive a copy of the GNU Lesser General Public License from
30+
http://www.gnu.org/
31+

Diff for: buildscripts/ZipPack/7za.dll

241 KB
Binary file not shown.

Diff for: buildscripts/ZipPack/7za.exe

638 KB
Binary file not shown.

Diff for: buildscripts/ZipPack/build-package.bat

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
rem Generate the zip Release package.
2+
3+
@echo off
4+
5+
rem get parameters that are passed by visual studio post build event
6+
SET TargetName=%1
7+
SET Dllversion=%~n2
8+
SET KSPversion=%3
9+
10+
rem make sure the initial working directory is the one containing the current script
11+
SET scriptPath=%~dp0
12+
SET rootPath=%scriptPath%..\..\
13+
SET initialWD=%CD%
14+
15+
echo Generating %TargetName% for %KSPversion% Release Package...
16+
cd "%rootPath%"
17+
xcopy /y "%initialWD%\%TargetName%.dll" GameData\%TargetName%\Plugins\%TargetName%.dll*
18+
19+
IF EXIST package\ rd /s /q package
20+
mkdir package
21+
cd package
22+
23+
mkdir GameData
24+
cd GameData
25+
26+
mkdir "%TargetName%"
27+
cd "%TargetName%"
28+
xcopy /y /e "..\..\..\GameData\%TargetName%\*" .
29+
xcopy /y ..\..\..\CHANGES.md .
30+
xcopy /y ..\..\..\LICENSE.txt .
31+
32+
echo.
33+
echo Compressing %TargetName% for %KSPversion% Release Package...
34+
IF EXIST "%rootPath%%TargetName%*_For_%KSPversion%.zip" del "%rootPath%%TargetName%*_For_%KSPversion%.zip"
35+
"%scriptPath%7za.exe" a "..\..\..\%TargetName%%Dllversion%_For_%KSPversion%.zip" ..\..\GameData
36+
37+
cd "%rootPath%"
38+
rd /s /q package
39+
40+
cd "%initialWD%"

Diff for: src/RemoteTech/RemoteTech.csproj

+36-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
33
<PropertyGroup>
4+
<ProjectGuid>{42155D82-1F25-4E59-9F65-64ABC583F420}</ProjectGuid>
45
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
56
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProjectGuid>{42155D82-1F25-4E59-9F65-64ABC583F420}</ProjectGuid>
77
<OutputType>Library</OutputType>
88
<AppDesignerFolder>Properties</AppDesignerFolder>
99
<RootNamespace>RemoteTech</RootNamespace>
@@ -13,46 +13,49 @@
1313
<TargetFrameworkProfile />
1414
</PropertyGroup>
1515
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<DebugSymbols>false</DebugSymbols>
17-
<DebugType>none</DebugType>
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
1818
<Optimize>false</Optimize>
19-
<OutputPath>..\..\GameData\RemoteTech\Plugins\</OutputPath>
19+
<OutputPath Condition="Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">$(KSPDEVDIR)\GameData\RemoteTech\Plugins\</OutputPath>
20+
<OutputPath Condition="!Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">obj\RemoteTech\</OutputPath>
2021
<DefineConstants>DEBUG;TRACE</DefineConstants>
2122
<ErrorReport>prompt</ErrorReport>
2223
<WarningLevel>4</WarningLevel>
23-
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
24+
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
2425
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
26+
<LangVersion>default</LangVersion>
2527
</PropertyGroup>
2628
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2729
<DebugType>none</DebugType>
2830
<Optimize>true</Optimize>
29-
<OutputPath>..\..\GameData\RemoteTech\Plugins\</OutputPath>
30-
<DefineConstants>TRACE</DefineConstants>
31+
<OutputPath Condition="Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">$(KSPDEVDIR)\GameData\RemoteTech\Plugins\</OutputPath>
32+
<OutputPath Condition="!Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">obj\RemoteTech\</OutputPath>
33+
<DefineConstants>
34+
</DefineConstants>
3135
<ErrorReport>prompt</ErrorReport>
3236
<WarningLevel>4</WarningLevel>
33-
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
37+
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
38+
<LangVersion>default</LangVersion>
3439
</PropertyGroup>
3540
<ItemGroup>
3641
<Reference Include="Assembly-CSharp">
37-
<HintPath>Assembly-CSharp.dll</HintPath>
42+
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
3843
<Private>False</Private>
3944
</Reference>
4045
<Reference Include="Assembly-CSharp-firstpass">
41-
<HintPath>Assembly-CSharp-firstpass.dll</HintPath>
46+
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
4247
<Private>False</Private>
4348
</Reference>
4449
<Reference Include="System" />
4550
<Reference Include="System.Core" />
4651
<Reference Include="System.Xml.Linq" />
47-
<Reference Include="System.Data.DataSetExtensions" />
48-
<Reference Include="System.Data" />
4952
<Reference Include="System.Xml" />
5053
<Reference Include="UnityEngine">
51-
<HintPath>UnityEngine.dll</HintPath>
54+
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
5255
<Private>False</Private>
5356
</Reference>
5457
<Reference Include="UnityEngine.UI">
55-
<HintPath>UnityEngine.UI.dll</HintPath>
58+
<HintPath Condition="Exists('$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.UI.dll')">$(KSPDEVDIR)\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
5659
<Private>False</Private>
5760
</Reference>
5861
</ItemGroup>
@@ -146,4 +149,21 @@
146149
<Compile Include="NetworkFeedback.cs" />
147150
</ItemGroup>
148151
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
149-
</Project>
152+
<Target Name="PostBuildMacros">
153+
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
154+
<Output TaskParameter="Assemblies" ItemName="Targets" />
155+
</GetAssemblyIdentity>
156+
<ItemGroup>
157+
<VersionNumber Include="@(Targets->'%(Version)')" />
158+
</ItemGroup>
159+
</Target>
160+
<PropertyGroup>
161+
<PostBuildEventDependsOn>
162+
$(PostBuildEventDependsOn);
163+
PostBuildMacros;
164+
</PostBuildEventDependsOn>
165+
<PostBuildEvent>if "$(ConfigurationName)"=="Release" (call "$(ProjectDir)..\..\buildscripts\ZipPack\build-package.bat" $(TargetName) -v@(VersionNumber) KSP1.4.5)
166+
if "$(ConfigurationName)"=="Debug" (call "$(ProjectDir)..\..\buildscripts\UnityDebug\prepare-debug.bat" $(TargetName))
167+
</PostBuildEvent>
168+
</PropertyGroup>
169+
</Project>

0 commit comments

Comments
 (0)