TFS build does not apply the value of $(VSInstallDir) macros - tfs

I have a build-machine and I have made simple changes recently to run editbin.exe tool with LARGEADDRESSAWARE parameter right after each building. The tool is located in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin (of course, the path can be another). And I have added new target to the build.proj file:
<Exec command=""$(VSInstallDir)\VC\bin\editbin.exe" /LARGEADDRESSAWARE "Manager.exe""/>
If I run MS Build locally on the build machine it works properly. Good! But after any checkin build is not able to be completed with the following error:
The command ""\VC\bin\editbin.exe"" exited with code 3. As I understand TFS build does not apply the value of $(VSInstallDir) macros (C:\Program Files (x86)\Microsoft Visual Studio 12.0\ in my case). Any suggesting?

To resolve the problem I did the next: In VS build config: Process->Build process parameters->5. Advances->MSBuild arguments added /p:VSInstallDir = Value

Related

MSBUILD: error MSB1009: Project file does not exist on Azure Devops TFS

I am receiving the above error when trying to run my build. I have looked at the other answers to this question and have ensured that the project does build in VS2019, that my solution paths are correct and that I have checked the clean box in my Visual Studio Build Task. I'm at a loss and was hoping that someone will see something I am missing. Here is the error log I receive:
2019-12-05T16:51:51.4631828Z ##[section]Starting: Build solution
CONSurvey
2019-12-05T16:51:51.4635684Z
============================================================================== 2019-12-05T16:51:51.4635853Z Task : Visual Studio build
2019-12-05T16:51:51.4636005Z Description : Build with MSBuild and set
the Visual Studio version property
2019-12-05T16:51:51.4636138Z Version : 1.151.2
2019-12-05T16:51:51.4636254Z Author : Microsoft Corporation
2019-12-05T16:51:51.4636405Z Help : More
Information
2019-12-05T16:51:51.4636579Z
2019-12-05T16:51:53.3057099Z
[command]"E:\tfs-agents\DHSS_VSTS_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
2019-12-05T16:51:53.6381113Z ##[command]"C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe"
"E:\tfs-agents\DHSS_VSTS_work\233\s\CONSurvey.sln" /nologo /nr:false
/t:"Clean" /fl
/flp:"logfile=E:\tfs-agents\DHSS_VSTS_work\233\s\CONSurvey.sln.log;verbosity=diagnostic"
/dl:CentralLogger,"E:\tfs-agents\DHSS_VSTS_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=99b4b9b2-7001-494c-962a-5d5532ebc121|SolutionDir=E:\tfs-agents\DHSS_VSTS_work\233\s"*ForwardingLogger,"E:\tfs-agents\DHSS_VSTS_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"
/p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false
/p:DeployOnBuild=true;OutDir="E:\tfs-agents\DHSS_VSTS_work\233\a"
/p:platform="any cpu" /p:configuration="release"
/p:VisualStudioVersion="16.0"
/p:_MSDeployUserAgent="VSTS_15c81635-e2c4-41a0-95f6-2d0b2f6cbc4d_build_129_0"
2019-12-05T16:51:53.7934752Z MSBUILD : error MSB1009: Project file
does not exist.
2019-12-05T16:51:53.7973651Z Switch:
E:\tfs-agents\DHSS_VSTS_work\233\s\CONSurvey.sln
2019-12-05T16:51:53.9286545Z ##[error]Process 'msbuild.exe' exited
with code '1'.
2019-12-05T16:51:53.9661712Z ##[command]"C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe"
"E:\tfs-agents\DHSS_VSTS_work\233\s\CONSurvey.sln" /nologo /nr:false
/fl
/flp:"logfile=E:\tfs-agents\DHSS_VSTS_work\233\s\CONSurvey.sln.log;verbosity=diagnostic"
/dl:CentralLogger,"E:\tfs-agents\DHSS_VSTS_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=1029b97a-fe32-4d73-b976-928576336049|SolutionDir=E:\tfs-agents\DHSS_VSTS_work\233\s"*ForwardingLogger,"E:\tfs-agents\DHSS_VSTS_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"
/p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false
/p:DeployOnBuild=true;OutDir="E:\tfs-agents\DHSS_VSTS_work\233\a"
/p:platform="any cpu" /p:configuration="release"
/p:VisualStudioVersion="16.0"
/p:_MSDeployUserAgent="VSTS_15c81635-e2c4-41a0-95f6-2d0b2f6cbc4d_build_129_0"
2019-12-05T16:51:54.1134908Z MSBUILD : error MSB1009: Project file
does not exist.
2019-12-05T16:51:54.1135166Z Switch:
E:\tfs-agents\DHSS_VSTS_work\233\s\CONSurvey.sln
2019-12-05T16:51:54.1648429Z ##[error]Process 'msbuild.exe' exited
with code '1'.
2019-12-05T16:51:54.2165236Z ##[section]Finishing: Build solution
CONSurvey
Edit: Yes, the solution file is there. It is not missing.
MSBUILD: error MSB1009: Project file does not exist on Azure Devops TFS
The cause of this issue usually comes from two aspects, one is the issue with the build definition settings, and the other is the issue of your project/solution itself.
For the build definition settings, you need to check if you omitted the actual solution file in the Solution text box instead of a solution path. For example,
The following shows just the folder path and this setting produces the error:
This is the correct setting with the solution file to build:
This setting has been a source of confusion due to the heading on the dialog to select the Path and not say select the Path to the Solution file.
For the ssue of your project/solution itself, since we do not have your solution/projects, we could not point directly to the issue. But you could build solution in the local machine without Azure devops, then check if you still have this issue.
Note: If you can build it success in you local machine, make sure you have check all required files to the source control.
Hope this helps.

How to fix "error APPX0002: Task 'ValidateAppxManifest' failed" error when running an MsBuild.exe command as a service?

I try to run an MSBuild command to package an UWP application from an azure TFS build step.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" "C:\TFSagent\_work\1\s\MyProject.sln" /t:Build /p:Configuration=master /p:Platform=x86"
This command execute well when i log onto the remote VM agent and i just execute the command: package is created just fine as expected.
But when the command is executed via TFS Agent that runs as a service i got the following error :
2019-06-16T22:15:16.0141845Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2638,5): error APPX0002: Task 'ValidateAppxManifest' failed. Namespace prefix 'm' is not defined. [C:\TFSagent\_work\1\s\MyProject.vcxproj]
2019-06-16T22:15:16.0142853Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2638,5): error APPX0002: [C:\TFSagent\_work\1\s\MyProject.vcxproj]
2019-06-16T22:15:16.9689847Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2638,5): error MSB4018: The "ValidateAppxManifest" task failed unexpectedly. [C:\TFSagent\_work\1\s\MyProject.vcxproj]
2019-06-16T22:15:16.9690436Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2638,5): error MSB4018: System.Xml.XPath.XPathException: Namespace prefix 'm' is not defined. [C:\TFSagent\_work\1\s\MyProject.vcxproj]
...
Running: Microsoft Visual Studio Team Foundation Server Version 16.131.28507.4
Agent is setup as a service, on a windows 10 vm, using a local user, that is granted administrator rights.
Build Step is as simple as a command-line executing te above command.
I've tried adding /nodeReuse:false /m:1.
There is no use of any 'm' namespace in the corresponding manifest (and as it works when runnning 'by hand' i suppose the manifest itself is fine)
I just expect the command to work the same when running from a user or a service.
EDIT 1:
i may have found where the 'm' namespace comes from (when using /v:diag:
Task Parameter:
AppxManifestSchemas=
C:\Program Files (x86)\Windows Kits\10\\Include\10.0.18362.0\WinRT\FoundationManifestSchema.xsd
NamespaceAlias=m
NamespaceUri=http://schemas.microsoft.com/appx/manifest/foundation/windows10
C:\Program Files (x86)\Windows Kits\10\\Include\10.0.18362.0\WinRT\UapManifestSchema.xsd
NamespaceAlias=uap
NamespaceUri=http://schemas.microsoft.com/appx/manifest/uap/windows10 (TaskId:271)
EDIT 2
in the non working msbuild diag log, the parameter AppxManifestSchemas does not appear at all, probably explaining the intial error.
next step : finding why the parameter is not send to the task.
​Solution found!
​
​I had a Variable in my Build Definition named "SdkVersion" which was used to control the target sdk i wanted to build on.
​This variable was used in my command line only.
Thing is, TFS is creating an environment variable for each variable in the build configuration.
​
​During the MsBuild PRocess, and specifically task 'GetSdkPropertyValue' (task which is a dependecy for ValidateAppxManifest', which apparently add some AppxManifestSchema, including one with NamespaceAlias=m )​
, there is a parameter named 'SDKVERSION' .. by default (when running manually) it takes the value '10.0' but as i had a variable with same name, it was overidde with '10.0.18362.0' which leads to adding no appxmanifestschema...
​
​Took me a month :p

configuring jenkins msbuild path

I have configured a new msbuild path and name
in the jenkins configure tool. The configuration pointing to v15
I receive thew following error:
C:\jenkins_slave\cortana\workspace\xxx\testing>exit 0 FATAL:
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\MSBuild\15.0\Bin doesn't exist Build step
'Build a Visual Studio project or solution using MSBuild' marked build
as failure
How can I solve it?
In second screenshot you need to put slash at the end of the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\
However, to use Jenkins MSBuild plugin for VS2017 there are other things to consider. Launching MSBuild executable in my case required bunch of environment variables to be configured which otherwise are set in "Development Command Prompt".
I am contemplating using "dotnet build", "dotnet test" etc. in command line instead.

Jenkins MSTestRunner plugin is unable to launch mstest.exe

I've configured the Jenkins MSTestRunner plugin to use the following path to the MSTest executable: 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe'. However, although this path is correct, the build fails as follows:
cmd.exe /C "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" "/resultsfile:/resultsfile testresults" /testcontainer:Project.Tests/bin/Debug/Project.Tests.dll && exit %%ERRORLEVEL%%
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
What's the issue here, I thought this would be the normal way of configuring the MSTestRunner plugin as mstest.exe is installed beneath Visual Studio, which is again typically installed under 'C:\Program Files (X86)'? How do I work around this?
Have received confirmation from the plugin author that MSTestRunner 0.2.0 doesn't handle spaces in MSTest paths. I worked around the issue by instead creating an "Execute Windows batch command" build step in Jenkins that invokes mstest.exe directly, where I've surrounded the mstest.exe path with double quotes:
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:Project.Tests\bin\Debug\Project.Tests.dll /resultsfile:testresults.trx
Found that my issue was 2 fold.
File entries are from local workspace dir
You must configure mstest in global tools and then select that instance within the build step.

Build Installshield project using TFS build

I am working on Installshield and TFS (VSTS 2008) and now I want to build Installshield 2011 Project along with build definition.
For this I have created build.proj file which contains build definitions to build .sln projects which is working fine.
Now at end of Build definition file I have added like this :
<Target Name="AfterCompile">
I have added the reference of Installshield project, so that after building Visual Studio projects start building Installshield projects at the end:
<Exec Command=""$(DevEnvDir)\Common7\IDE\devenv" E:\Sw\Manual_Build_TFS_R3\Setup.isproj /Build"/>
Earlier I have used VSINSTALLDIR in palce of DevEnvDir still error will come which says
Task "Exec"
Command:
"\Common7\IDE\devenv" E:\Sw\Manual_Build_TFS_R3\Setup.isproj /Build
The system cannot find the path specified.
E:\BuildSource\Temp\BuildType\TFSBuild.proj(444,5): error MSB3073: The command ""\Common7\IDE\devenv" E:\Sw\Manual_Build_TFS_R3\Setup.isproj /Build" exited with code 3.
Done executing task "Exec" -- FAILED.
Done building target "AfterCompile" in project "TFSBuild.proj" -- FAILED.
Done Building Project "E:\BuildSource\Temp\BuildType\TFSBuild.proj" (EndToEndIteration target(s)) -- FAILED.
Build FAILED.
"E:\BuildSource\Temp\BuildType\TFSBuild.proj" (EndToEndIteration target) (1) ->
(AfterCompile target) ->
E:\BuildSource\Temp\BuildType\TFSBuild.proj(444,5): error MSB3073: The command ""\Common7\IDE\devenv" E:\Sw\Manual_Build_TFS_R3\Setup.isproj /Build" exited with code 3.
0 Warning(s)
1 Error(s)
I am new to this VSTS and TFS build configurations.
We use something like this:
Command=""%programfiles%\Microsoft Visual Studio 8\Common7\IDE\devenv" ..."
Would that work for you?
-- EDIT --
Another thought that came to mind is the suggestion that you consider WIX instead of InstallShield. WIX projects work really well within MSBuild.
I can't think of any valid reason that the path to your InstallShield project should be hard-coded as it appears in your question.
Can you build the *.isproj file from the command line with MSBuild? If so, then you could just add it to your solution and set it up to only build for a new solution configuration that you use in your TFS build.

Resources