Build/Test Issues

Webjobs.wap.targets file causing build failure

Started by cskardon on 11,623 views

Hi,

I've just added a webjobs project to a solution, (via right-clicking on the web application, selecting 'add' and new webjob).

NCrunch is now failing to build the web project quoting:


..\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.wap.targets (52): The "ReadWebJobsConfigFile" task could not be loaded from the assembly C:\Users\Chris\AppData\Local\NCrunch\15708\29\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\Microsoft.Web.WebJobs.Publish.Tasks.dll. Could not load file or assembly 'Microsoft.WindowsAzure.Management.Scheduler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.



If I look in the 'packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\' I can see the .Tasks.dll and Microsoft.WindowsAzure.Management.Scheduler.dll, the solution itself builds fine, I've tried adding the tools folder as 'Additional files to include' in the configuration, but no joy.

Anything else I should try?

Cheers

Chris

Edited

OK,

So I edited my csproj file and removed the reference to the targets file, saved and NCrunch was back in happy territory.
Next, I added the WebJobs project I had created as an existing WebJob to the same website project and it so far (crossed fingers) appears to be in a happy place.
Hi Chris,

This is likely due to failed automatic resolution of the task DLL file used by the webjob.

Try including the Microsoft.Web.WebJobs.Publish.1.0.2 package directory in the project using the 'Additional files to include' project-level configuration - http://www.ncrunch.net/documentation/reference_project-configuration_additional-files-to-include.

This will ensure that the DLL is properly detected by NCrunch and copied to the workspace when it goes to build the project.
Hi Remco,

I had added the 'tools' folder of the 'Microsoft.Web.WebJobs.Publish.1.0.2' package - as that had all the dlls in but that didn't work.
In the root of the package is only a .nuspec file and this tools directory, would that have made a difference?

Cheers
Interesting. Does the DLL file exist in the NCrunch workspace? An easy way to check this is to right click on the failing build, then choose Advanced->Browse to workspace, and see if the file exists on the path its expected.

I don't think the .nuspec file will make any difference in this. You are correct in your understanding that the key directory would be 'tools'.
Hello. I have just run into this same problem. We recently added a web job project to our solution. As soon as we added the webjobs-list.json file to the web project, NCrunch stopped being able to build it. It shows this message:

..\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.wap.targets (52, 5): The "ReadWebJobsConfigFile" task could not be loaded from the assembly C:\Users\[me]\AppData\Local\NCrunch\12088\15\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\Microsoft.Web.WebJobs.Publish.Tasks.dll. Could not load file or assembly 'Microsoft.WindowsAzure.Management.Scheduler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Using advice from above posts, I was able to confirm that x.Publish.Tasks.dll is being copied to the workspace, but its dependency x.WindowsAzure.Management.Scheduler is not.

webjobs.wap.targets has these UsingTask elements...

<UsingTask TaskName="ReadWebJobsConfigFile" AssemblyFile="Microsoft.Web.WebJobs.Publish.Tasks.dll"/>
<UsingTask TaskName="DeterminePublishedWebJobs" AssemblyFile="Microsoft.Web.WebJobs.Publish.Tasks.dll"/>
<UsingTask TaskName="GetScheduleMetadata" AssemblyFile="Microsoft.Web.WebJobs.Publish.Tasks.dll"/>


I tried adding the following to the vs.ncrunchproject, within the <ProjectConfiguration> tag, to no avail (no idea if I did it right):

<ItemGroup>
<None Include="..\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\Microsoft.Web.WebJobs.Publish.Tasks.dll" />
<None Include="..\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\Microsoft.WindowsAzure.Management.Scheduler.dll" />
</ItemGroup>

Any ideas?
Hi,

This is certain to be a matter of including the file in NCrunch's discovery steps. Note that the ncrunchproject file is a configuration file that isn't intended to be modified manually. The declarations you've made by hand should actually be made to the project file itself (since NCrunch interrogates this when resolving dependencies).

Another way to solve this is under the NCrunch 'Additional files to include' setting for the project. Try including the entire 'packages' directory. This will ensure ALL packages are included in the workspace, which is quite broad, but it should catch any missing files. Assuming this solves the problem, you can then exclude the packages directory and try including individual packages to see if you can get a narrower range of files to include.

Edited

That worked. Thanks for your quick response!

Post a reply

Log in to reply.