MSbuild multi level project error while rebuilding with MSBuild in .Net solution

Error occuring while trying to build in MSBuild tool using gitlab

error MSB4036:
The “GetReferenceNearestTargetFrameworkTask” task was not found. Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is “public” and implements the Microsoft.Build.Framework.ITask interface.
3.) The task is correctly declared with in the project file, or in the *.tasks files located in the “C:\Program Files (x86)\MSBuild\15.0\Bin” directory. [C:\GitLab-Runner\builds\zyrsBjMz\0\akido\capella\capella\ImmunizationSubmission\ImmunizationSubmission.csproj]
“C:\GitLab-Runner\builds\zyrsBjMz\0\akido\capella\capella\EHR-Capella5.0.sln” (default target) (1) →

attaching file

NUGET_PATH: ‘C:\Program Files\Nuget\nuget.exe’

MSBUILD_PATH: ‘C:\Program Files\MSBuild\15.0\Bin\MSBuild.exe’

#MSBUILD_PATH: ‘C:\Program Files(x86)\MSBuild\15.0\Bin\MSBuild.exe’


  • build

  • deploy


- echo "Nuget script..start"

- '& "$env:NUGET_PATH" restore EHR_REPORTS2.0.sln'  # sourcecode\project.sln-This path includes project solution where is available and restoring

- echo "Nuget script..Completed"

build Job:

stage: build


- echo "Core Building..start"

#- '& "$env:MSBUILD_PATH" Core/Core.csproj/p:DeployOnBuild=true /p:Configuration=Release' 

- echo "Core Building..Completed"   

- '& “$env:MSBUILD_PATH”

DeployOnBuild=true /p:Configuration=Release /p:Platform=“Any CPU” /p:BuildInParallel=false/ P:PublishProfile=FolderProfile.pubxml’

- echo "UI Building..start"  

- '& "$env:MSBUILD_PATH" EHR_REPORTS2.0.sln /p:DeployOnBuild=true /p:Configuration=Release /p:Platform="Any CPU" /P:PublishProfile=FolderProfile.pubxml'    

- echo "Building..Completed"


expire_in: 365 days #artifcats will be stored only 365 days after this it will expire


 - '.\EHR_REPORTS2.0.sln\bin\Release\Publish\'

 - '.\EHR_REPORTS2.0.sln\bin\Publish\'

 #- '$env:TEST_FOLDER'

 #- '.\$env:MSTEST_PATH\*.*'

 #- '.\EHR_REPORTS2.0\EHR_REPORTS2.0.sln\bin\Release\Publish\'

 #- '.\EHR_REPORTS2.0\EHR_REPORTS2.0.sln\bin\Publish\'

deploy Job:

stage: deploy


- 'xcopy /y /s ".\EHR_REPORTS2.0\EHR_REPORTS2.0.sln\bin\Release\Publish\*.*" "E:\solutionDir"'  #Path where you want to store the solution