Invalid path on nuget restore step - tfs

I have TFS service on premise. I am trying to setup build and stuck on nuget restore step.
I have pass target solution to settings:
Path to solution or packages.config: $/MyProject/MySolution.sln
On log, nuget fails due to invalid directory
NuGet.exe restore -NonInteractive D:\TFS\agent01\_work\63\s -ConfigFile \\SomePath\Nuget.config -NoCache -Verbosity Detailed
As you can see, invalid target is passed to nuget.
It should be
D:\TFS\agent01\_work\63\s\$\MyProject\MySolution.sln
But is
D:\TFS\agent01\_work\63\s
In other projects works as expected. What could be wrong?

Do you have it declared as a build step? It looks like you somewhere put a remote path where it can't be resolved on the agent. I have a very similar setup running and it works with the NuGet-Installer build step:

It turned out that, the problem was Get Source step.
In Server path variable I had path to solution itself instead of( sln file) of folder to solution.

Related

TFS build error: Web deployment task failed. Package file does not have a .zip file name extension

I am getting the following error when I am queuing a build in TFS 2017.
"Microsoft.Web.Publishing.targets 3009,5): Error : Web deployment task failed. (Package file 'C:\agent_work\3\s\TestApp\TestApp\release' does not have a .zip file name extension.)"
I am not sure why I am getting this error. I have hosted agent on the TFS server. I created the build definition according to this video:
www.youtube.com/watch?v=HjD4A-yeFTE
Does somebody have any idea? Appreciate your help!
Test at my side and everything works correctly.
Please try below items to narrow down the issue:
Please check the drop folder, if the .zip file actually being in the
place that you expected.
Try to specify the output path, eg:
/p:PackageLocation="$(build.artifactstagingdirectory)\\" , then
specify the Copy Root path as $(build.artifactstagingdirectory)
in Copy and Publish Build Artifacts task.
Explicitly specifying .zip extension in MSBuild Argument in the
Build Definition.
p:PackageLocation="$(BuildConfiguration)\package.zip
Check the build log, check if MSbuild works correctly. Also you can try the Msbuild command line locally to check if the .zip package can be generated.
Deploy a new agent on your Develop machine, create a new build
definition, then build with the new agent.
If still can not resolve the issue, just share the build logs here for further troubleshoot.

New TFS 2015 Web based build definition is not cleaning artifact from previous build even after specify clean

Building a solution with new web based build definition. passing MSBuild arguments during the build. checked clean options. but TFS is not removing old build artifacts from previous build, instead of removing an artifacts, it's giving just appending new one with old one.
using MS Build arguments: /p:DeployOnBuild=true /P:PackageTempRootDir=\Release /p:DeployIisAppPath="Default Web Site";DefaultPackageFileName=DemoApp.zip /p:OutputPath="$(Build.BinariesDirectory)\$(BuildPlatform)\$(BuildConfiguration)"
I tried by changing the name of DefaultPackageFileName with something else like (TestApp.zip)
if I see in my output folder. I am getting both zip file created instead of one. what can be issue?
Found it. Looks like in some cases, we need to pass variable Build.Clean with Value binary. found it from https://www.visualstudio.com/en-us/docs/build/define/repository
Thanks for response.
According to the comment above. Please copy this build definition to a new build definition.

VS2015 build with TFS2013

I'm trying to do a teambuild for a VS2015 solution with TFS2013.
On the buildserver VS2015 is installed and I changed the buildtemplate so msbuild has an argument \tv:14.0, but when a start a build I get the following error:
C:\Program Files
(x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets (96):
Invalid static method invocation syntax:
"[Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformSDKDisplayName($(TargetPlatformIdentifier),
$(TargetPlatformVersion))". Method
'Microsoft.Build.Utilities.ToolLocationHelper.GetPlatformSDKDisplayName'
not found. Static method invocation should be of the form:
$([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a,
b)).
The buildserver has been restarted but I still get the error.
I also checked this thread: Build failed in TFS but no real answer was given there. Is there anyone that knows how to solve this.
I was experiencing the exact same error. I determined that TFS2013 was the RTM version so we installed TFS2013 Update 5. Now if I run using the *.12.xaml process template with the /tv:14.0 /p:VisualStudioVersion=14.0 parameters the build succeeds. I have also made a copy of the *.12.xaml build process and named it *.14.xaml and changed the Run MSBuild steps ToolVersion property to "14.0" and this build works as well, without the parameters.
You need to customize the build process template by finding all the Run MSBuild for Project MSBuild activity, then set the ToolVersion to "14.0" and set ToolPath to target to MSBuild14 (by default: "C:\Program Files (x86)\MSBuild\14.0\Bin"). After that, check in the build process template and re-queue the build.
Check the solutions here:TFS 2013 building .NET 4.6 / C# 6.0

Error While Creating Build

I have TFS 2010 and for one of the team project I have created the build definition (used default build template) and added the solution of one of the project. But when try to create build getting the following error:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
(902): The command "if Debug == Debug copy
"C:\Builds\14\\\Sources\ServerObjects..\SharedInterfaces\bin\debug*.dll"
"C:\Builds\14\\\Sources\ServerObjects..\ServerObjects\bin\debug"" exited with
code 1.
I think you maybe has wrong folder structure on the source control, see my answer on similar question here
teambuilding and deploying a dll (e.g. wpftoolkit.extended.dll)
TeamBuild overrides the output folder so the bin\debug (or bin\release) folder won't exist. It collates the output into Binaries.
For your custom build step use the obj folder instead of bin as that'll be the same under both TeamBuild and the local machine build.

tf.exe Unable to detrmine the workspace

I am trying to call TF get command via Team Build script. I am getting the following error
Unable to determine the workspace.
Folks over the internet tell that this error is because Team Build cannot find the workspace because it is being called from a directory which is not part of the workspace.
The solution presented is to specify the working directory. I do so. The mappings are ok in Build Definition path as well as in the workspace. But now i get the following error:
Could not find cmd.exe in the current
directory . The directory name is
invalid.
Kindly help.
Thanks
Solved the problem. I added one more binding in my build Definition Workspace Section and referenced files to get/checkin/checkout with the help of variable $(MSBuildSourceDirectory). Meanwhile I ensured that $(SourceDir) is used to specify mapping in the workspace section of my Build Definiton dialog.
(source: geekswithblogs.net)
At the same time i encountered 260-character path limit, so i modified the output directory in build path as described here
(source: geekswithblogs.net)

Resources