1
votes

i have problem with TFS build, all time its failed with different type of errors, i resolved mostly, but still there are errors, i am not sure why these are and how these will resolve. i am sorry i can not explain more in detail.

error 1

C:\Builds\1\SmallBiz\SmallBiz-Web\Sources\SmallBiz.Web\SmallBiz.Web.csproj (9921): This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\.nuget\NuGet.targets.

error 2

Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

errors image

enter image description here

please help me or guide me, where i am wrong, what i am missing in configuration. i appreciate your valuable time and effort, thanks in advance.

1
do you have your bin folder checked into source control?Kritner
yes, i have already added bin folder on source control.adnan
@adrian you shouldn't, that might be part of your problem. Bin folder is rebuild at every build, it's not something that should make it into source controlKritner
may i need to exclude bin folder then check build?adnan
Not really sure... make sure your build server has the most up to date framework versions installed, the build server has access to the internet for nuget package restore, nuget package restore is enabled for the solution. Those errors look to me to be related to one of those things.Kritner

1 Answers

0
votes

finally i resolved my problem to remove the following tags or lines in .csproj file

  1. right click on project unload it
  2. right click on project to edit project file and remove the below code
1. <RestorePackages>true</RestorePackages>

2. <Import Project="$(SolutionDir)\.nuget\nuget.targets" />  

3. <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">  
        <PropertyGroup>
            <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, 
    see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        </PropertyGroup>
        <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
    </Target>
  1. under the solution Delete .nuget files from source control
  2. reload project and build it
  3. check in changes