"Illegal characters in path" error when building UWP project with SQLite extension on VSTS Hosted agent - sqlite

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.

Related

MSBuild not compiling with both /p:Configuration=Release and -p:Configuration=Debug

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.

Azure websites deployment fail - found conflicts between different versions of the same dependent assembly

My azure websites deployment is failing. Everything is working fine on my local machine: I can't see any problems or conflicts when log verbosity is set to detailed in Visual Studio's output window.
But I can't figure out how to see logs and fix the following error in Kudu when trying to deploy to Azure:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
All packages listed in packages.config are already installed.
MyProject.Broadbean -> D:\home\site\repository\MyProject.Broadbean\bin\Release\MyProject.Broadbean.dll
MyProject.Domain -> D:\home\site\repository\MyProject.Domain\bin\Release\MyProject.Domain.dll
MyProject.Mandrill -> D:\home\site\repository\Mandrill\bin\Release\MyProject.Mandrill.dll
D:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj]
D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(242,5): warning : No compiler log specified, 'Clean' won't work. [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj]
CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'D:\home\site\repository\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll' and 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Xml.ReaderWriter.dll'. Remove one of the duplicate references. [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj]
CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'D:\home\site\repository\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll' and 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.ComponentModel.Annotations.dll'. Remove one of the duplicate references. [D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\MyProject.WebUI\MyProject.WebUI.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d69b9dee0afc5a";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\79.20129.3767\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
How do I see this build log in Kudu or the Azure websites environment and fix these errors? I'm obviously missing something. The background is that I updated a lot of nuget packages, the site now breaks on deployment, and I can't quite figure out how to fix it.
To fix the "Multiple assemblies with equivalent identity have been imported. Remove one of the duplicate references." error, I removed the references for those assemblies.
That allowed me to deploy. But on deployment I got error screens because of conflicts between different assemblies.
To fix the "Found conflicts between different versions of the same dependent assembly that could not be resolved." conflicts, I removed the binding redirects for problematic assemblies in the web.config file.
What it is trying to say that
.net framework itself has System.Xml.ReaderWriter.dll so you don't have add it separately.
Please remove any reference of System.Xml.ReaderWriter.dll from your project .
similarly you have to do it for other assemblies .
Please debug you deploy.cmd using log in every steps which you think could cause build failure.
It seems that due to nuget update in your project, you have conflicts between different versions of the same dependent assembly. Please look at the assemblies you have upgraded and check their compatibility in your project.
I believe you must be running your build using some build agent, if you have access to the build agent and log in to the VM and try to debug your cmd file.
Also, please replicate and install the same environment in your Agent VM as you have it in your local, most of the time , this is the reason of build failure.
Hope it helps.

GIT based asp.net web app fails to deploy to Azure with typescript compile error

I have this asp.net (4.6.2) web application which compiles and runs fine on my local machine.
The project is in a Git repo in VSTS.
I want this site deployed to Azure web sites. So I make a Webapp and set the deployment option to my VSTS Git repo.
This will automatically trigger a deployment... which fails.. with this error:
All packages listed in packages.config are already installed.
D:\home\site\repository\FormBuilder\Scripts\typings\knockout\knockout.d.ts(335,13): error TS1110: Build: Type expected. [D:\home\site\repository\FormBuilder\FormBuilder.csproj]
D:\home\site\repository\FormBuilder\Scripts\typings\knockout\knockout.d.ts(338,11): error TS1109: Build: Expression expected. [D:\home\site\repository\FormBuilder\FormBuilder.csproj]
D:\home\site\repository\FormBuilder\Scripts\typings\knockout\knockout.d.ts(339,1): error TS1128: Build: Declaration or statement expected. [D:\home\site\repository\FormBuilder\FormBuilder.csproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\FormBuilder\FormBuilder.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d3e9219d2f6f3b";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\"
An error has occurred during web site deployment.
It looks to me like it's compiling my .d.ts files. Don't know why..VS2015 does not do that.
I tried to exclude this file in a tsconfig but that does not work.
How can I make this build succeed?
So the problem is that the Azure build machine is not equipped with typescript 2.0 (yet) and knockout.d.ts uses a 2.0 syntax for something. See the comments below the question.
GitHub issue here
You need to compile type script files before deploying to azure. In deploy.cmd file on azure you can add this code to Compile TypeScript right after the npm packages are installed.
echo Transpiling TypeScript in %DEPLOYMENT_TARGET%...call :ExecuteCmd node %DEPLOYMENT_TARGET%\node_modules\typescript\bin\tsc -p "%DEPLOYMENT_TARGET%"
You can find the deploy.cmd file on KUDU in site->deployments->tools section.

VSTS Build failing - Error : Web deployment task failed

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.

MSBUILD:error MSB1008: Only one project can be specified in Jenkins

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

Resources