TFS2010 build automation cannot find reference on network share
I have a file reference in a project located on a network share. This builds without issue on all developer machines.
When I try to execu开发者_StackOverflow中文版te an automated build, the build fails citing error CS0246: The type or namespace name 'Assembly' could not be found...
The reference (\server\References\Shared\Release\Assembly.dll) is discoverable by the server and the build service account has modify permissions to the folder (and assembly).
The Project definition contains a valid hintpath tag to \server\References\Shared\Release\ and I have added /p:ReferencePath="\server\References\Shared\Release" to the MSBuild Arguments property (although I don’t think these settings should be necessary).
Does anyone have any other suggestions?
This is the log snippet from the failed build:
ResolveAssemblyReferences:
Primary reference "DataLayer".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DataLayer". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Builds\1\APPNAME\APPNAME\6\Sources\APPNAME.Logger\APPNAME.Logger.csproj]
For SearchPath "\\SERVERNAME\References\Shared 2.0\Release".
Considered "\\SERVERNAME\References\Shared 2.0\Release\DataLayer.dll", but it didn't exist.
Considered "\\SERVERNAME\References\Shared 2.0\Release\DataLayer.exe", but it didn't exist.
For SearchPath "{HintPathFromItem}".
Considered "\\SERVERNAME\c$\References\Shared 2.5\Release\DataLayer.dll", but it didn't exist.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\DataLayer.exe", but it didn't exist.
Considered "C:\Windows\Microsoft.NET\Framework\v3.5\DataLayer.dll", but it didn't exist.
Considered "C:\Windows\Microsoft.NET\Framework\v3.5\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\DataLayer.exe", but it didn't exist.
Considered "C:\Windows\Microsoft.NET\Framework\v3.0\DataLayer.dll", but it didn't exist.
Considered "C:\Windows\Microsoft.NET\Framework\v3.0\DataLayer.exe", but it didn't exist.
Considered "C:\Windows\Microsoft.NET\Framework\v2.0.50727\DataLayer.dll", but it didn't exist.
Considered "C:\Windows\Microsoft.NET\Framework\v2.0.50727\DataLayer.exe", but it didn't exist.
For SearchPath "{Registry:Software\Microsoft\.NETFramework,v3.5,AssemblyFoldersEx}".
Considered "C:\Program Files\Reference Assemblies\Microsoft\VSTA\v9.0\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\VSTA\v9.0\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft Chart Controls\Assemblies\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft Chart Controls\Assemblies\DataLayer.exe", but it didn't exist.
For SearchPath "{AssemblyFolders}".
Considered "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft.NET\ADOMD.NET\100\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft.NET\ADOMD.NET\100\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\DTS\Tasks\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\DTS\Tasks\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\DataLayer.exe", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\DTS\ForEachEnumerators\DataLayer.dll", but it didn't exist.
Considered "C:\Program Files\Microsoft SQL Server\100\DTS\ForEachEnumerators\DataLayer.exe", but it didn't exist.
For SearchPath "{GAC}".
Considered "DataLayer", which was not found in the GAC.
For SearchPath "{RawFileName}".
Considered treating "DataLayer, Version=2.5.0.0, Culture=neutral, PublicKeyToken=22db5dc9ded3fd82, processorArchitecture=MSIL" as a file name, but it didn't exist.
For SearchPath "C:\Builds\1\APPNAME\APPNAME\6\Binaries\".
Considered "C:\Builds\1\APPNAME\APPNAME\6\Binaries\DataLayer.dll", but it didn't exist.
Considered "C:\Builds\1\APPNAME\APPNAME\6\Binaries\DataLayer.exe", but it didn't exist.
DataLoyer.dll definatley exists in \SERVERNAME\References\Shared 2.0\Release.
I had a similar problem where building with Visual Studio and also MSBuild on the command line would succeed, but building with the same MSBuild invocation from within Jenkins would fail. The build was failing because MSBuild could not resolve some third party DLLs (specifically they were Telerik controls) installed into C:\Program Files
(and not the GAC).
I cranked up the verbosity of MSBuild when it worked and noticed that it searched the correct path as the first entry under the resolution step headed with:
For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.0,AssemblyFoldersEx}"
I went digging in the registry at HKEY_CURRENT_USER\Software\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx
and found a single entry for the Telerik binaries folder there. Since Jenkins runs as a service under the SYSTEM user, I figured it wasn't hitting this registry location and so I copied the entry to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx
.
That did the trick. Not sure how good/bad this is or if there's another way to solve it, but it worked well for me.
I would suggest to check in the dll into version control, that way it can be versioned along with your sourcecode and the assembly will be in your workspace so that you won't have network security issues.
精彩评论