I am facing an error while building project in Jenkins and Asp.net. My source code is on TFS. Below is the error message (Console output) for my build.
No history entries were found for the item and version combination specified.
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
Executing the command cmd.exe /C C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe /t:Rebuild "/p:Configuration=Debug:Platform="Any CPU":CustomBuildPath="C:\\Program Files (x86)\\Jenkins\\jobs\\PerformanceTest\\workspace\\PerformanceTest"" "C:\Program Files (x86)\Jenkins\jobs\PerfomanceTest\workspace\PerformanceTest\PerformanceTest.sln" && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\jobs\PerfomanceTest\workspace
[workspace] $ cmd.exe /C C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe /t:Rebuild '/p:Configuration=Debug:Platform="Any CPU":CustomBuildPath="C:\\Program Files (x86)\\Jenkins\\jobs\\PerformanceTest\\workspace\\PerformanceTest"' "C:\Program Files (x86)\Jenkins\jobs\PerfomanceTest\workspace\PerformanceTest\PerformanceTest.sln" && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.18063]
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: Files
For switch syntax, type "MSBuild /help"
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE
Please resolve it.
Thanks in advance.
This is probably due to the double-quotes in Platform="Any CPU". Try to remove that and see if it works.
Or try moving the SLN file path to the beginning of the command, before the switches.
In vs2012 just try to create a Build definition "Test Build" using the default TFS template "DefaultTemplate....xaml" (usually a copy of it)
It will fail with the usual self-explaining-error
MSBUILD : error MSB1008: Only one project can be specified.Switch: Activities`
Of course somewhere in the default TFS template some " are missing so msbuild will receive as parameter a non escaped directory containing spaces so will result in multiple projects(?!)
So NEVER use spaces in you TFS Build Definition names, pretty sad and simple at the same time
R.Ballarino
Related
We are attempting to install a clean build of the newest version of Kentico (12) on Azure, using Kudu, in DEBUG configuration. We traditionally accomplish this by setting SCM_BUILD_ARGS to -p:Configuration=Debug, and all is well. But for some reason in this newer version, the project fails to compile, and I see that this is the command being run:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\Users\User\Documents\GitHub\Project\CMS\CMSApp.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:\local\Temp\8d6d315018f5ff9";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="C:\Users\User\Documents\GitHub\Project\.\\" -p:Configuration=Debug
Notice both Configuration=Release and Configuration=Debug. The compilation errors are things like Invalid expression term 'string' on the following line of code:
bool licenseOK = LicenseHelper.CheckLicenseLimitations(FeatureEnum.Ecommerce, out int skuCount, out int maxSKUCount);
This doesn't highlight at all in Visual Studio in Debug or Release mode. I am also able to reproduce locally (as shown in my paths above), and if I change the two configurations to both be the same (regardless of whether I choose Debug or Release), it compiles just fine.
What I know I can do is create my own custom deployment command script file as a work-around, but I guess I don't understand why the above MSBUILD command isn't working in the first place.
Any ideas as to why this would work great for all of my ASP.NET projects prior to this one? One thing I know is that Kentico recently included the Roslyn compiler, which I am unfortunately not that familiar with - could that be part of the issue?
UPDATE #1: It appears all of the compilation errors have to do with code that is only valid in C# 7.0. That could be a clue.
It all came down to the fact that the newer versions of Kentico had code that was only valid in C# 7, and required MSBuild 15 to compile. Here's how I was able to set up Kudu:
Add a file named .deployment in the root of my repo, containing only the contents below. This tells Kudu to use a custom deployment script.
Download the deploy.cmd file from my Azure App Service via FTP to the root of my repo, and update it per https://github.com/projectkudu/kudu/issues/2350#issuecomment-373817740 to use the MSBuild 15 path. Details below.
.deployment file contents
[config]
command = deploy.cmd
deploy.cmd updates
1 - Add -MSBuildPath "%MSBUILD_15_DIR%" to nuget call. Example:
nuget.exe restore "{your .sln file path}" -MSBuildPath "%MSBUILD_15_DIR%"
2 - Replace %MSBUILD_PATH% with %MSBUILD_15_DIR%\MSBuild.exe in both occurrences under step 2. Build to the temporary path
This was all that was needed in order to get the build to complete.
As Keith mentions, it was a compatibility issue with C# 7.0 that Kentico 12 uses. This SO thread mentions that you need to run MSBuild version 15 for C# 7.0 code. I ran a similar debug command for my local Kentico 12 project using MSBuild 15, and it succeeded.
I get the following error when I try building my solution in a multi core build agents.
C:\Program Files (x86)\Microsoft Visual
Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Web\Deploy\Microsoft.Web.Publishing.Deploy.FileSystem.targets(96,5):
error : Copying file obj\Release\Package\PackageTmp\bin\roslyn\csi.exe
to
C:\buildAgent\work\f7321f5187869991\Deploy_output\www\bin\roslyn\csi.exe
failed. The process cannot access the file
'C:\buildAgent\work\f7321f5187869991\Deploy_output\www\bin\roslyn\csi.exe'
because it is being used by another process.
[C:\buildAgent\work\f7321f5187869991\src\Feature\VersionPruner\code\Sitecore.Feature.VersionPruner.csproj]
The msbuild command I use to trigger the build is
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\MSBuild.exe" ..\MySolution.sln "/target:Rebuild" /verbosity:minimal /toolsversion:15.0 /nologo /maxcpucount /p:Configuration=%1 /property:DeployOnBuild="true" /property:DeployDefaultTarget="WebPublish" /property:WebPublishMethod="FileSystem" /property:DeleteExistingFiles="false" /property:publishUrl="%cd%\_output\www" /property:_FindDependencies="false" /p:BuildSourceFolder="%cd%\..\src" /p:BuildOutputBaseFolder="%cd%\_output\configs" /property:BuildOutputWWWFolder="%cd%\_output\www"
The solution builds successfully when maxcpucount property is set to 1.
I have a build definition in Visual Studio Team Services (previously Visual Studio Online) to build an ASP.NET web application using an on-premise agent. The agent has VS2012 installed and all the other necessary prerequisites to assist in building the application. However, when running the build, it fails and outputs below error:
C:\Program Files
x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4021,2):
Error : Web deployment task failed. (The .zip file package
'C:\BuildAgent\_work\1\a\' must be a file, not a directory.)
Process 'msbuild.exe' exited with code '1'.
I tried building the project on the agent machine using VS2012 and it builds fine. Also, I have defined following MSBuild parameters in the build definition which is same as my other builds that use a hosted agent:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
What could be the cause of this issue? Do I need to install anything extra?
You are using VS2012, you need to specify detail PackageLocation argument with .zip suffix ($(build.artifactstagingdirectory)\testWeb.zip). If you are using higher version of VS/MSBuild (e.g. vs 2015), a folder path is ok, it will adds [XXX].zip to the end of that path.
I have a VS 2012 solution(ASP.NET) that contains three projects. I'm trying to deploy/publish the site via MsBuild command line without installing Visual Studio on our build machine.
I am using:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild Myproject.csproj /p:DeployOnBuild=true /p:PublishProfile= pubfile.pubxml /p:Password=user1 /p:AllowUntrustedCertificate=true
MY Command line output show only "build successfully" of the solution but nothing about the publish profile.
The same solution and batch file run successfully on my local machine.
Please suggest If any option for publishing without install VS on build Machine
I had to add the following to my command line
/p:VisualStudioVersion=11.0
or you might have to install Web Deploy on your build machine.
The other thing I had to do was publish from VS and save a publish profile and then used that on the command line. I see you have pubfile.xml, but all I had to do was reference the profile name, not the file name. QA being my profile name from the project. Try removing the .xml on the end of yours.
/p:PublishProfile=QA
Add C:\Windows\Microsoft.NET\Framework\v4.0.30319\ to your %PATH% system environment variable and invoke your command:
msbuild Myproject.csproj /p:DeployOnBuild=true /p:PublishProfile= pubfile.pubxml /p:Password=user1 /p:AllowUntrustedCertificate=true
When using a Hosted agent to build my UWP application on VSTS I'm getting an error:
_GenerateAppxSymbolPackage:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\PDBCopy.exe C:\a\1\s\App\MyApp\bin\ARM\Debug\MyApp.pdb obj\ARM\Debug\Stripped\MyApp.pdb
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\PDBCopy.exe C:\a\1\s\App\Extensions\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015\3.11.1\Redist\Debug\ARM\sqlite3.pdb obj\ARM\Debug\Stripped\sqlite3.pdb
##[error]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2550,5): Error APPX0002: Task 'GenerateAppxSymbolPackage' failed. Illegal characters in path.
My build definition runs for app solution file against VS15 with params:
/p:AppxBundlePlatforms="$(BuildPlatform)" /p:AppxPackageDir="$(Build.BinariesDirectory)\AppxPackages\" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=CI
Everything else is default UWP build definition configuration on VSTS.
Note: my CI build for the same project builds successfully. The only difference there is the lack of /p:UapAppxPackageBuildMode=CI flag.
Any ideas / hints on what might be wrong with those paths? Or is it some bug in VSTS?
The MSBuild Arguments should be like:
/p:AppxBundlePlatforms="$(BuildPlatform)" /p:AppxPackageDir="$(Build.BinariesDirectory)\AppxPackages\\" /p:AppxBundle=Always
There is a \\ after AppxPackages, not \ .
Deleting everything except .git folder and then doing hard reset helped.