.NET build process: Postbuild bash script "exited with code 1" -
i trying build .net project in jetbrains rider on osx. project run on windows machines, trying build on osx machine. part of getting run, needed convert .bat
-file .sh
-file i've done , works when running in command line.
the bash script:
#!/usr/bin/env bash almadir="$pwd/alma/web/views/sharedviews" crossworddir="$pwd/crossword/web/views/sharedviews" archivedir="$pwd/archive/web/views/sharedviews" admindir="$pwd/admin/web/views/sharedviews" if [ -l "$almadir" ]; rm "$almadir" fi ln -s "$pwd/common/web.shared/views" "$almadir" if [ -l "$crossworddir" ]; rm "$crossworddir" fi ln -s "$pwd/common/web.shared/views" "$crossworddir" if [ -l "$archivedir" ]; rm "$archivedir" fi ln -s "$pwd/common/web.shared/views" "$archivedir" if [ -l "$admindir" ]; rm "$admindir" fi ln -s "$pwd/common/web.shared/views" "$admindir"
i know can improved in several ways, i'm trying keep simple , not overcomplicate things.
i have added condition .csproj
file run correct file depending on platform being used:
<propertygroup condition="'$(os)' == 'unix'"> <prebuildevent>$(projectdir)\..\..\runprerequisites.sh</prebuildevent> </propertygroup> <propertygroup condition="'$(os)' == 'windows'"> <prebuildevent>$(projectdir)\..\..\runprerequisites.bat</prebuildevent> </propertygroup>
this working fine, script execution fails following error:
microsoft.common.currentversion.targets(1291, 5): [msb3073] command "my_path_obscured/folder/web/../../runprerequisites.sh" exited code 1.
any ideas might going wrong? need return .sh
-script understand it's done or something? .bat
-file working fine has.
thanks!
i got work , post solution here if else happens run in same issue.
my problem partly environment related, partly limited shell-script-knowledge related. when running .sh
-script in terminal on osx , getting current working dir $pwd
, works fine. however, when running shell-script msbuild
, in case rider build button, process running folder (usually /bin
somewhere in solution). makes path invalid , script fails.
to answer, ran msbuild
terminal better error logging output. gave me error log instead of limited 1 inside rider:
microsoft (r) build engine version 15.3.0.0 (d15.3/17f02c2 thu jul 20 17:04:26 edt 2017) mono copyright (c) microsoft corporation. rights reserved. build started 2017-09-12 16:42:40. project "my_path_obscured/folder/web/projectname.csproj" on node 1 (default targets). prebuildevent: my_path_obscured/folder/web/../../runprerequisites.sh ln: my_path_obscured/folder/web/bin/../../alma/web/views/sharedviews: no such file or directory ln: my_path_obscured/folder/web/bin/../../crossword/web/views/sharedviews: no such file or directory ln: my_path_obscured/folder/web/bin/../../archive/web/views/sharedviews: no such file or directory ln: my_path_obscured/folder/web/bin/../../admin/web/views/sharedviews: no such file or directory /library/frameworks/mono.framework/versions/5.2.0/lib/mono/msbuild/15.0/bin/microsoft.common.currentversion.targets(1291,5): error msb3073: command "my_path_obscured/folder/web/../../runprerequisites.sh" exited code 1. [my_path_obscured/folder/web/projectname.csproj] done building project "my_path_obscured/folder/web/projectname.csproj" (default targets) -- failed. build failed.
the solution in case edit path works when running rider, since doing. it's fragile solution though , wouldn't recommend doing unless they're in same position me. 1 proper solution instead alter shell-script gets correct project folder opposed current directory.
Comments
Post a Comment