问题
From my local machine to a development server, Web Deploy 3.0 works fine with Visual Studio 2012 publish profiles using the following command:
msbuild .\myproj.csproj /verbosity:d /p:DeployOnBuild=true;PublishProfile=Develop;VisualStudioVersion=11.0;AllowUntrustedCertificate=true;username=xx;password=xx
When running this same command from the CI server (happens to be Jenkins but this should apply to any), the command finishes successfully, but no web site is ever deployed.
When comparing the log output, a large section appears to be skipped by the build server. It is occuring just after the 2 lines listed below (these 2 lines of output are identical when running local or on the CI server):
Target "PrepareForRun" in file "C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets" from project "C:_Application\proj\src\proj.Web\proj.Web.csproj" (target "CoreBuild" depends on it): Done building target "PrepareForRun" in project "proj.Web.csproj".
When running locally, this is followed up by what is shown below (plus hundreds more lines of logging):
Target "InsertAdditionalWebCofigConnectionStrings" skipped, due to false condition; ($(InsertAdditionalWebCofigConnectionStrings) And '@(_ConnectionStringsToInsert)' != '') was evaluated as (True And '' != ''). Target "_CleanWPPIfNeedTo" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets" from project "C:_Application\proj\src\proj.Web\proj.Web.csproj" (target "PipelineCollectFilesPhase" depends on it): Task "ReadLinesFromFile"
On the CI server, this directory appears to be missing:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets
Would a missing targets cause it to fail silently? Where does this folder come from (missing the entire Web folder on the CI server)?
回答1:
Have you installed Visual Studio on your build server? It seems like a strange thing to do at first (and isn't strictly necessary), but it certainly in the easiest way to resolve all these issues.
You can manually copy the required targets files from your PC on to the build server, but you'll be playing a trial and error game to get it to work.
Also if MS release new out of band
updates, like Asp.Net and Web Tool 2012.2
which they did recently, it's a much easier install procedure for the build server than to try and work out what targets have changed and copy them up manually.
Let me know if this helps.
来源:https://stackoverflow.com/questions/15529845/web-deploy-3-0-wont-work-on-ci-server