TFS2010 构建自动化无法在网络共享上找到参考

发布于 2024-11-02 09:13:05 字数 6111 浏览 3 评论 0原文

我在位于网络共享的项目中有一个文件引用。这在所有开发人员机器上构建都没有问题。

当我尝试执行自动构建时,构建失败,并引用错误 CS0246:找不到类型或命名空间名称“Assembly”...

引用 (\server\References\Shared\Release\ Assembly.dll)可由服务器发现,并且生成服务帐户具有对该文件夹(和程序集)的修改权限。

项目定义包含到 \server\References\Shared\Release\ 的有效提示路径标记,并且我已将 /p:ReferencePath="\server\References\Shared\Release" 添加到 MSBuild Arguments 属性(尽管我不认为这些设置应该是必要的)。

有人还有其他建议吗?

这是失败构建的日志片段:

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 存在于 \SERVERNAME\References\Shared 2.0\Release 中。

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 execute 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青朷 2024-11-09 09:13:05

我遇到了类似的问题,在命令行上使用 Visual Studio 和 MSBuild 进行构建会成功,但是从 詹金斯会失败。构建失败,因为 MSBuild 无法解析某些第三方 DLL(特别是它们是 Telerik 控件)安装到C:\Program Files(而不是GAC)。

当 MSBuild 工作时,我提高了它的详细程度,并注意到它搜索了正确的路径作为解决步骤下的第一个条目:

For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.0,AssemblyFoldersEx}"

我在注册表中进行了挖掘 HKEY_CURRENT_USER\Software\Microsoft\.NETFramework\v4。 0.30319\AssemblyFoldersEx 并在那里找到 Telerik 二进制文件夹的单个条目。由于 Jenkins 在 SYSTEM 用户下作为服务运行,我认为它没有命中此注册表位置,因此我将该条目复制到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx。

这就成功了。不确定这有多好/坏,或者是否有其他方法可以解决它,但它对我来说效果很好。

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.

简单 2024-11-09 09:13:05

我建议将 dll 签入版本控制,这样它就可以与源代码一起进行版本控制,并且程序集将位于您的工作区中,这样您就不会遇到网络安全问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文