RemoteTechnologiesGroup / RemoteTech

Community developed continuation of Kerbal Space Program's RemoteTech mod.
http://remotetechnologiesgroup.github.io/RemoteTech
GNU General Public License v2.0
233 stars 102 forks source link

Building with Visual Studio #753

Closed PiezPiedPy closed 6 years ago

PiezPiedPy commented 6 years ago

Hard-coded file paths in Visual Studio .csproj file have been removed and replaced with an Environment variable $KSPDEVDIR.

We use this scheme with Kerbalism and Trajectories.

Also brought the .csproj file up to date with these changes:

Updated .gitignore to ignore VS2015+ cache files.

KSP-TaxiService commented 6 years ago

Hi,

I think I understand why these changes (except for build files) would make a developer's life easier. It should be fine once I verify on my side that these changes (except for build files) would not impact on the release building significantly.

However, it appears that the build scripts are to be called from .csproj when executing Build Release/Debug. I am not sure if these scripts would be invoked when we are using a Continuous Integration service (currently AppVeyor) to download source codes, build, test, pack, deploy and notify in an automatic method.

I need to verify separately that the build scripts won't be called when the .csproj is executed by the service.

I will ask any question if necessary.

PiezPiedPy commented 6 years ago

The build scripts are aimed at building local zips for a contributors private use. the release script is not essential although the debug script is needed for debugging with breakpoints etc with Visual Studio as it generates the needed .mdb file

KSP-TaxiService commented 6 years ago

Hi, may I ask which Visual Studio version are you using? It appears to be 2017.

I have this error when compiling in VS 2015 on my side with KSPDEVDIR setup.

The OutputPath property is not set for project 'RemoteTech.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

I tried CI service with VS2017 (no KSPDEVDIR variable) and the same error came out.

Microsoft (R) Build Engine version 15.7.180.61344 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(780,5): error : The OutputPath property is not set for project 'RemoteTech.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\projects\remotetech-2hf2t\src\RemoteTech\RemoteTech.csproj]

Kindly assist to provide some instructions to resolve this error.

PiezPiedPy commented 6 years ago

I use VS2017 but the config should work fine with VS2015 as the Trajectories and Kerbalism configs are known to work with VS2015.

If you are using a windows system a newly created Env Var only takes effect after a restart. Also make sure the path you have specified in your Env Var exists.

Note in csproj the OutputPath is defined as: <OutputPath Condition="Exists('$(KSPDEVDIR)\GameData\RemoteTech\Plugins\')">$(KSPDEVDIR)\GameData\RemoteTech\Plugins\</OutputPath> Your KSPDEVDIR Env Var should point to the root of your install. screenshot 6

Re the CI build I can add a couple of lines to fix that error. I did not cater for CI in the csproj file, sorry I was not aware you where using it at the time I modified csproj. I will add a commit ;)

PiezPiedPy commented 6 years ago

Also your .csproj.user file may have the output dir set, which will override .csproj settings. Maybe try deleting you .user file and restart VS

KSP-TaxiService commented 6 years ago

It seems on my side, VS cache on .csproj wasn't fully purged. Only temporary edits to the file forces the cache wiping and (I am idiot. OutputPath Condition requires the RT folder to pass. It mean CI will fail on this).

I am able to compile fine (after changing another error). Also, KSPDEVDIR env var needs to be in system variables instead of user variables as I use a Windows standard account for daily activities. I will edit your note in CONTRIBUTING.md after this.

@PiezPiedPy, is it possible to change these 2 lines of .csproj from latest to default?

\ \latest\ \

Error came out when I tried to compile.

CS1617 Invalid option 'latest' for /langversion; must be ISO-1, ISO-2, Default or an integer in range 1 to 6.

Re the CI build I can add a couple of lines to fix that error. I did not cater for CI in the csproj file, sorry I was not aware you where using it at the time I modified csproj. I will add a commit ;)

Yes, please. This would help too.

PiezPiedPy commented 6 years ago

I've changed the language version to default and added a conditional for CI

KSP-TaxiService commented 6 years ago

This pull request provides significant improvements over the current and outdated pipeline.

I will push the necessary changes onto this PR to build successfully in the CI service.

Thanks for helping to streamline the RT build process!