Gorillapower on Thu, 23 Jun 2016 09:21:30
We are having an issue deploying a webapp with a related webjob to azure.
1. Our setup is as follows; 1 webapp with 1 webjob referenced by webjobs-list.json in TFS.
2. Our VSTS build definition restores nuget and builds the projects on the solution level. It has the following msbuild arguments.
"/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:PackageLocation=$(build.stagingDirectory) /p:PackageAsSingleFile=true"
3. The build step outputs two files webapp.zip and webjob.zip.
4. There are two deployment steps, first step is to deploy the webapp.zip and the second is to deploy the webjob.zip (the order turns out to be important!)
5. All steps and deployments are successful.
When we browse our webApp, we get the following error.
Server Error in '/' Application. Could not load file or assembly 'System.Web.WebPages.Razor, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
If we check the build logs, we see that the webjob deployed some dlls to the bin folder overriding the previous deployment dlls, which causes this error. If we switch the deploy step order around (webjob first, webapp second) this problem disappears.
You can see the files that were overriden in the build log below, specifically the razor dll, which causes the above error.
1. Is there a way to deploy a webapp and a webjob in one deployment step (there is a way using powershell to copy the app_data folder, its here https://maxwellweru.com/asp-net-5-webapp-with-webjob-and-vs/, im looking for an alternative)?
2. Is there way to be able to deploy webapp and webjob separately but not run into this deployment order issue (ie only app_data folder from webjob should be packaged in the build step)?
Tingting MO on Fri, 24 Jun 2016 01:19:55
Base on your reply, you are using Visual Studio Team Service(VSO). I help you move this case to Visual Studio Team Service forum for dedicated support.
Thank you for your understanding.