I'm trying to publish a project with the command line msbuild. My project is a Web Application and I am using Microsoft Visual Studio Professional 2017 Version 15.2 (26430.13) Release . Here's my command :
msbuild C:\Test\MyProject.csproj /p:DeployOnBuild=true /p:PublishProfile="Debug - PUBLISH PROFILE"
I've set my profile with a Platform and a Target Location, but when I execute the command, here's the returned output :
The OutputPath property is not set for project 'MyProject.csproj'. Please check to make sure
that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Pl
atform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and
have specified a non-default Configuration or Platform that doesn't exist for this project.
No destination specified for Copy. Please supply either "DestinationFiles" or "Destination Folder".
The "FindUnderPath" task was not given a value for the required parameter "Path".
It seems that my profile is getting unrecognized, so it takes the default value.
Someone know why ? Thx.
It worked with this command line :
bat "msbuild \"C:\\Test\\MyProject.csproj\" /P:DeployOnBuild=true /P:PublishProfile=\"Debug - PUBLISH PROFILE"\ /P:PublishProfileRootFolder=\"C:\\Test\\Properties\\PublishProfiles\" /P:AllowUntrustedCertificate=true /P:Platform=x86 /P:Configuration=\"Debug - CONFIGURATION PROFILE"\ "
Thx !
Related
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.
I'm new to CI/CD and can't find any information on the internet on how to use AppCenter Test with TFS 2018. I have my Xamarin projects in TFS but I want to test them within the device cloud of AppCenter Test.
There are a couple documents on MS's docs that make it look like it's possible but for a newbie they give ZERO information on how to implement it. HERE is an example. If you look up top this document is relavant to TFS 2018.
In Azure Pipeline, you can use either YAML or the classic editor to define your pipelines. But YAML build is not supported in TFS 2018 yet.
So you need to use the classic editor to add App Center Test task to your pipeline and then refer to the Arguments in the documentation to define the task.
Here is what I did to get it working. No idea if it's correct or not, but hey, it works!
Xamarin.UITest
If you don't do the following step you'll run your tests locally and
nothing will happen, they'll just immediately exit.
First go to Tools > Options > Test > General > Active Solution then uncheck For improved performance, only use test adapters in test assembly folder or as specified in runsettings file
public class AppInitializer
{
public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp.Android
// You may need to adjust the following relative path based on where you created your UITest project
.ApkFile(#"..\..\..\<AppName>\<AppName>.Android\bin\Release\<App Package Name>.apk")
// Uncomment if you are running locally and you want VS to launch/install app
//.PreferIdeSettings()
.StartApp();
}
return ConfigureApp.iOS.StartApp();
}
}
Do not add references to your Android and iOS projects like the MS
docs say. This will lead you down the path of hours of useless troubleshooting
Deploy your agent on a development windows box. Follow these instructions: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
TFS 2018 Configuration
In TFS click into the repository of your project
Click "Build and Release"
Up top right click "+New"
Click "Continue"
Scroll down and click "Xamarin.Android"
on the next screen set the Agent queue to whatever you created ealier, probably Default
List of my build tasks
Nuget Tool Installer
.NET Core
Nuget
Xamarin.Android
MSBuild
Android signing
Node Tool Installer
Nuget
App Center Test
Here are my build steps in detail
Nuget Tool Installer
Use Nuget
version of nuget to install : 4.9.3 (this is what I noticed my VS was using)
all else defaults
.NET Core
command: restore
path to projects: **/*.csproj
all else defaults
Nuget
Command: custom
Command and arguments: restore -MsbuildPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
All else defaults
Xamarin.Android
Project: **/*Droid*.csproj
Target: (empty)
Output directory: $(build.binariesdirectory)\$(BuildConfiguration)
Configuration: $(BuildConfiguration)
MSBuild: enable Specify Location
MSBuild Location: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
JDK Options, JDK 8 x64
all else defaults
MSBuild
Project: (fit this to match your uitest project): **/*UITest*.csproj
MSBuild version: Latest
Platform: (empty)
Configuration: $(BuildConfiguration)
MSBuild Arguments: /p:OutputPath="$(build.binariesdirectory)\$(BuildConfiguration)\test-assembly"
all else defaults
Android Signing
APK Files: $(build.binariesdirectory)\$(BuildConfiguration)\*.apk
Check sign the APK and put in your info
Jarsigner arguments: -verbose -sigalg MD5withRSA -digestalg SHA1
Check to Zipalign
Zipalign location: (empty)
all else defaults
Node Tool Installer
Version Spec: (choose whatever version you already have on your system) 10.11.0
all else defaults
Note: Prior to the next step create a new variable called
XamarinUITestVer and set the value to whatever value you want to use
for the Xamarin.UITest Nuget package you want to install. In my case
the value I set was: 2.2.7
Nuget
Command: custom
Command and Arguments (refer to note above): install Xamarin.UITest -Version $(XamarinUITestVer) -OutputDirectory "$(Agent.BuildDirectory)\Nuget"
all else defaults
App Center Test
Binary Application File Path: $(build.binariesdirectory)\$(BuildConfiguration)\*.apk
Artifacts Directory: $(Build.ArtifactStagingDirectory)\AppCenterTest
Check: 'Prepare Tests`
Test Framework: Xamarin UI Test
Build Directory: $(build.binariesdirectory)\$(BuildConfiguration)\test-assembly
Store File: (empty)
Store Password: (empty)
Key Alias: (empty)
Key Password: (empty)
Test Tools Directory: $(Agent.BuildDirectory)\Nuget\Xamarin.UITest.$(XamarinUITestVer)\tools\
Signing Information: (empty)
Additional Options: (empty)
Check: Run Tests
Authentication Method: App Center Connection
App Center Connection: (create a new connection)
App Slug: obtain this by "almost" creating a test in AppCenter. From your app in AppCenter create a New Test Run, select device(s), select Next and choose Xamarin.UITest and hit Next. Down below you'll see the --app string and this is what you use for this field.
Devices: obtain this by "almost" creating a test in AppCenter. From your app in AppCenter create a New Test Run, select device(s), select Next and choose Xamarin.UITest and hit Next. Down below you'll see the --devices string and this is what you use for this field.
all else defaults
This is my first blog or query. I am very new to TFS Admin role and sonarqube tool.
We are using TFS 2013 as an ALM in our project, the project is based on .Net Application (new to .NET as well).
As per the client requirement, I am trying to integrate the "SonarQube 5.2" with the customized build process template instead of default template.
I installed the "SonarQube 5.2" on "ABC server" and my "TFS server/build agent" is on "XYZ".
I installed the SonarQube Scanner for MSBuild 2.1 on XYZ server and updated the environment variables & sonarqube runner xml accordingly.
As per the standard link I am not using default template:-http://docs.sonarqube.org/display/SCAN/From+Team+Foundation+Server+2013
and using a customized build template, which hadn't have pre/post build argument options.
So I edited in the customized build process template, added hooks for pre/post build scripts activities and updated the properties similar to the mentioned link :-
http://www.colinsalmcorner.com/post/build-script-hooks-for-tfs-2012-builds
Note: As per the above link, I didn’t update "Challenge 2 – Environment Variables" part in the process template as I am not running any powershell script only wanted to execute the MSBuild.SonarQube.Runner.exe.
Used following activity & properties within the customized process template (refer above link):
*ConvertWorkspaceItem activity, set the following properties:
• DisplayName: “Get pre-build script local path”
• Input: PreBuildScriptPath
• Result: preBuildScriptLocalPath
• Workspace: Workspace
Set the following properties in the InvokeProcess activity:
• Arguments: String.Format(" ""& '{0}' {1}"" ", prebuildScriptLocalPath, PreBuildScriptArgs)
• DisplayName: “Run pre-build script”
• FileName: “PowerShell”
• Working Directory: SourcesDirectory*
Note: Same thing done for post build script
Sequentially, I placed these pre and post script activities under "Try, Compile and Test" activity of the process template.
In the MS build definition which is using the customized process template, I am setting below values in build process parameters (location/path of runner.exe on XYZ server) :
Pre-build script path : C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe
Pre-build script arguments : begin /n: /v:< project version #> /k:
Post-build script path : C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe
Post-build script arguments : end
But after all these changes, my build is getting partially successful and sonarqube integration is failed with the following error:
*The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between the begin and end steps
2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
3. The begin, build or end steps have not all been launched from the same folder*
Note: On XYZ server (TFS build server) we do have MSBuild 12.0 and build is happening under SourcesDirectory as ".sonarqube" folder is getting created within the same directory.
Also on XYZ server's command prompt (within the location of SourceDirectory or where the ApplicationName.sln is available), I ran following sonarqube commands, my analysis was successful and reports generated on Sonarqube dashboard:
- MSBuild.SonarQube.Runner begin /n:<project name> /v:< project version #> /k: <project key>
- "C:\Program Files (x86)\MSBuild\12.0\Bin\Msbuild.exe" "ApplicationName.sln" /p:Configuration=Debug /p:Platform="Any CPU"
- MSBuild.SonarQube.Runner end
Kindly go through this, it will be a great help if someone can guide me and provide some concrete explanation to resolve this.
Let me know if you need any other information.
as I read in your comment:
MSBuild.SonarQube.Runner is installed on "C:\sonarquberunner\" and
MSBuild is under
"C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe" and my
build directory on TFS server is
"D:\data\Build\$(BuildAgentId)\$(BuildDefinitionPath)" (location of
source code for build).
You have installed MSBUILD 12, but the Build agent is calling the version 4.0
You need to modify your build process template in order to achieve that.
Find the Run MSBuild activity in your build template and set the ToolPath = “C:\Program Files (x86)\MSBuild\12.0\bin\” or the path of your MSBUILD 12
You may try to specify the /n:/k:arguments:
/k:"the project key of the SonarQube project to which the build
definition relates"
/n:"the project name of the SonarQube project"
Also, instead of Post-build script path and Post-build script arguments, try to set the Post-test script path to the full path to MSBuild.SonarQube.Runner.exe, and set the Post-test script arguments to end.
Check the screenshot below:
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
I have an MVC Web application built with VS 2013.
For deploying it, I've created a web deploy package publish profile with all the required settings (like MSDeployParameterValue, _CustomFiles etc.) and can publish to a package by using the publish dialog.
What I need is to make the build process to be automatic.
I have not found any option to provide the MSBuild with my publish profile (.pubxml) in order to use the publish profile settings.
Is there any option to do this?
The command line I use to build the project is as follows:
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" C:\Projects\MyProject.csproj /P:Configuration=Debug /P:DeployOnBuild=true /P:DeployTarget=Package /P:_PackageTempDir=C:\packages /P:CreatePackageOnPublish=True /P:VisualStudioVersion=12.0
Thank you very much.
Got it. The correct parameter is PublishProfile and its value should be an existing profile name.
See the correct example:
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" C:\Projects\MyProject.csproj /P:Configuration=Debug /P:DeployOnBuild=true /P:DeployTarget=Package /P:PublishProfile=MyProfile /P:_PackageTempDir=C:\packages /P:CreatePackageOnPublish=True /P:VisualStudioVersion=12.0