我在网络共享上的项目中有一个文件引用。这在所有开发人员计算机上都没有问题。
当我尝试执行自动构建时,构建失败,引用错误CS0246:找不到类型或命名空间名称'Assembly'...
服务器可以发现引用(\ server \ References \ Shared \ Release \ Assembly.dll),构建服务帐户具有对文件夹(和程序集)的修改权限。
项目定义包含一个到\ server \ References \ Shared \ Release \的有效hintpath标记,我已将/ 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。
答案 0 :(得分:2)
我遇到了类似的问题,即在命令行上使用Visual Studio和MSBuild构建会成功,但使用Jenkins内的相同MSBuild调用构建将失败。构建失败,因为MSBuild无法解析安装到C:\Program Files
(而不是GAC)的某些第三方DLL(特别是Telerik controls)。
我在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
。
这就是诀窍。不确定这是好/坏,或者是否有另一种解决方法,但它对我有用。
答案 1 :(得分:0)
我建议将dll检入版本控制,这样它就可以与源代码一起进行版本化,并且程序集将在您的工作区中,这样您就不会遇到网络安全问题。