How I managed to do so:
- Add
BuildScript.csx
file to your project, containing the script you wish to run at pre-build (VS2017 would interpret .csx files as C# (intelisense etc.))
Add the following to the pre-build commands, to call the C# script compiler on your script:
"C:\Program Files (x86)\MSBuild\14.0\Bin\csi.exe" "$(ProjectDir)BuildScript.csx"
You can improve this and future usage of csi.exe by adding C:\Program Files (x86)\MSBuild\14.0\Bin\
to Path
environment variable, so the command would be:
csi "$(ProjectDir)BuildScript.csx"
P.S:
Could you please specify what exactly are you trying to do? There might be more simple solution.