Warning failed to resolve moles dll files on build server

We use 0.94 mats for some tests in our solution. However, every time it is compiled first, the build server raises a couple of warnings:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1360): Could not resolve this reference. Could not locate the assembly "XXX.Moles, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 

I understand that the build server will try to resolve all references of the test project before the build starts, and if it cannot find the moles dll in the molesassembly folder (because it is empty for the first time), this will generate a warning similar to the one above.

But when msbuild starts building this test project, the assembly of the malls will be generated and copied to the moleassemblies folder, so it will not turn into an error.

In general, the first time the assembly will be partially successful, and the next time the assembly will be fully successful.

We are trying to not have any warnings on the build server. Is there a way to clear this warning on the build server?

+4
source share
1 answer

We have all third-party assemblies stored in the Assemblies folder in the project root folder. All third-party assemblies used in any of our projects refer to this place. The Assemblies folder is included in TFS.

It looks like you are referencing the XXX.Moles assemblies from the output folder, not some shared folder (Assemblies). Try updating your links to using third-party libraries in the Assemblies folder instead of the output folder of your test project.

EDIT: try adding a check to see if the assembly XXX.Moles exists in the Reference tag, for example:

 <Reference Condition="Exists('..\molesassemblies\XXX.Moles.dll')" Include="XXX.Moles.dll"> <SpecificVersion>False</SpecificVersion> <HintPath>..\molesassemblies\XXX.Moles.dll</HintPath> </Reference> 
+3
source

Source: https://habr.com/ru/post/1389456/


All Articles