Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Illegal characters in path" error in compiling and packaging azure web app with web job

I have an web application "WebApplication2" (Azure API) with a web job "WebJob1". I want to package the application along with the web job to a zip file in order to deploy the package to the cloud. When I do it via visual studio (Publish -> web deploy package) it works like a charm. But when I'm trying to do it via MSBuild (for automation purposes) I'm getting this error: The command:

C:\Program Files (x86)\MSBuild\14.0\Bin>MSBuild.exe "C:\Users\levs\Documents\Visual Studio 2015\Projects\WebApplication2\WebApplication2\WebApplication2.csproj" /p:OutputPath="C:\Users\levs\Documents\webPublish\MSBuildOutputPath" /p:DeployOnBuild=true /p:PackageLocation=C:\Users\levs\Documents\webPublish\test.zip /verbosity:m

The output:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(2606,5): error : Copying file C:\Users\levs\Documents\webPublish\MSBuildOutputPath**\*.* to obj\Debug\Package \PackageTmp\app_data\jobs\continuous\WebJob1\*.* failed. Illegal characters in path. [C:\Users\levs\Documents\Visual Studio 2015\Projects\WebApplication2\WebApplication2\WebApplication2.csproj]

Do you have any idea what I'm doing wrong?

BTW, the compilation of each project (the application and the webjob) separately with MSBuild works.

MSBuild version : Microsoft (R) Build Engine version 14.0.25420.1

like image 555
Strelnikov Lev Avatar asked Nov 07 '22 21:11

Strelnikov Lev


1 Answers

Not sure what you were using for scripting the automation but I've had similar trouble using MSBuild in Cake with my web job. Hopefully this might help anyone else who stumbles upon the same issue.

My original paths during the copy were this:

Copying C:\Test\Portal.WebApp\build\Package**\*.* to obj\Release\Package\PackageTmp\app_data\jobs\triggered\PortalWebJob\*.*

The issue I believe was with this part.

Package**\*.*

To fix this I added slash to end of my OutputPath.

settings.WithProperty("OutputPath", MakeAbsolute(packageDir).ToString() + "/");

This seemed to fix things for me, I know you may not being using Cake scripts but hopefully this might steer you in the right direction.

like image 146
GC9 Avatar answered Nov 14 '22 21:11

GC9