lith 1 år sedan
förälder
incheckning
1824cfb110

+ 5 - 2
Publish/DevOps2/build-bash/19.get-app-version.bash

@@ -26,8 +26,11 @@ cd $curPath
 
 
 #----------------------------------------------
-echo "#1 get appVersion" 
-export appVersion=`grep '<Version>' $(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1) | grep -oE '\>(.*)\<' | tr -d '<>/'`
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
 echo "appVersion from csproj: $appVersion"
 
 # get v1 v2 v3

+ 5 - 2
Publish/DevOps2/build-bash/20.change-app-version.bash

@@ -26,8 +26,11 @@ cd $curPath
 
 
 #----------------------------------------------
-echo "#1 get appVersion" 
-export appVersion=`grep '<Version>' $(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1) | grep -oE '\>(.*)\<' | tr -d '<>/'`
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
 echo "appVersion from csproj: $appVersion"
 
 # get v1 v2 v3

+ 5 - 2
Publish/DevOps2/build-bash/21.change-to-next-version.bash

@@ -26,8 +26,11 @@ cd $curPath
 
 
 #----------------------------------------------
-echo "#1 get appVersion" 
-export appVersion=`grep '<Version>' $(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1) | grep -oE '\>(.*)\<' | tr -d '<>/'`
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
 echo "appVersion from csproj: $appVersion"
 
 # get v1 v2 v3