5

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

3
  • did you try moving your source code to a direct folder location something like "D:\src " windows has this number of characters issue. This is not that exactly. But you can give this a try. Commented May 24, 2017 at 8:52
  • 2
    Add a trailing slash after MSBuildOutputPath in your command because MSBuildOutputPath** is miss interpreted by msbuild. It must be MSBuildOutputPath\** Commented May 24, 2017 at 9:14
  • Already tried both suggestions, no success Commented May 24, 2017 at 9:56

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

I fixed this by finding the MSBuildOutputPath value that was failing, copying it, adding a trailing slash, and then specifying that new string as the OutputPath argument.

So if the output that is giving me that error was "C:/myDesiredOutputPath/bin" I needed to specify MSBuild should use "C:/myDesiredOutputPath/bin/" with a trailing slash.

msbuild /p:OutputPath=C:/myDesiredOutputPath/bin/

This answer may be helpful.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.