【发布时间】:2019-11-06 14:33:00
【问题描述】:
我有一个包含 3 个类库项目(业务逻辑、数据访问层、Web 服务)的解决方案。
我可以在 Visual Studio 中构建解决方案。
但是,当构建任务在 Azure DevOps 中运行时,它会因命名空间或类型不存在的错误而失败。该错误是针对依赖于另一个的类库项目之一。
这可能是什么问题?
第二部分是,当我为 Web 应用程序添加构建任务时,如何确保 Web 应用程序可以从类库项目解决方案的第一次构建中正确引用 DLLS(以便构建自身正确)?
以下是解决方案文件的摘录 - “未找到”错误与 MatterDBLibrary 项目有关。
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterDBBusinessEntities", "MatterDBBusinessEntities\MatterDBBusinessEntities.csproj", "{EC049257-C855-47DC-A2DF-02910DBC34A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MattersDBService", "MattersDBService\MattersDBService.csproj", "{34F4FE24-948B-4EF2-8252-7FDA8430616F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterDBLibrary",
"MatterDBLibrary\MatterDBLibrary.csproj", "{D76D1BFC-8B1E-4A3F-AC76-3218CA28E5D7}"
ProjectSection(ProjectDependencies) = postProject
{34F4FE24-948B-4EF2-8252-7FDA8430616F} = {34F4FE24-948B-4EF2-8252-7FDA8430616F}
{EC049257-C855-47DC-A2DF-02910DBC34A3} = {EC049257-C855-47DC-A2DF-02910DBC34A3}
EndProjectSection
EndProject
MatterDB 参考资料:
<ProjectReference Include="..\MatterDBBusinessEntities\MatterDBBusinessEntities.csproj">
<Project>{ec049257-c855-47dc-a2df-02910dbc34a3}</Project>
<Name>MatterDBBusinessEntities</Name>
</ProjectReference>
MatterDBService 参考:
<ProjectReference Include="..\MatterDBBusinessEntities\MatterDBBusinessEntities.csproj">
<Project>{ec049257-c855-47dc-a2df-02910dbc34a3}</Project>
<Name>MatterDBBusinessEntities</Name>
</ProjectReference>
第三个项目(MatterDBBusinessEntities)对以上两个没有依赖。
##[warning]MattersDB\DEV\MatterDBLibrary\Fakes\MatterDBBusinessEntities.fakes(0,0): Warning : Some fakes could not be generated. For complete details, set Diagnostic attribute of the Fakes element in this file to 'true' and rebuild the project.
2019-06-24T17:37:09.1641534Z D:\a\1\s\MattersDB\DEV\MatterDBLibrary\Fakes\MatterDBBusinessEntities.fakes : warning : Some fakes could not be generated. For complete details, set Diagnostic attribute of the Fakes element in this file to 'true' and rebuild the project. [D:\a\1\s\MattersDB\DEV\MatterDBLibrary\MatterDBLibrary.csproj]
2019-06-24T17:37:09.2160099Z ResolveAssemblyReferences:
2019-06-24T17:37:09.2160196Z Primary reference "MatterDBBusinessEntities".
2019-06-24T17:37:09.2161791Z ##[warning]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "MatterDBBusinessEntities". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2019-06-24T17:37:09.2163119Z C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "MatterDBBusinessEntities". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\1\s\MattersDB\DEV\MatterDBLibrary\MatterDBLibrary.csproj]
2019-06-24T17:37:09.2163318Z For SearchPath "{HintPathFromItem}".
2019-06-24T17:37:09.2163467Z Considered "..\MatterDBBusinessEntities\bin\Debug\MatterDBBusinessEntities.dll", but it didn't exist.
2019-06-24T17:37:09.2163632Z For SearchPath "{TargetFrameworkDirectory}".
2019-06-24T17:37:09.4347164Z C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /unsafe+ /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:D:\a\1\s\MattersDB\DEV\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll /reference:D:\a\1\s\MattersDB\DEV\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll /reference:"D:\a\1\s\Deals\Phase 3\DEV\ExternalReference\Korzh.EasyQuery.Db.NET45.dll" /reference:"D:\a\1\s\Deals\Phase 3\DEV\ExternalReference\Korzh.EasyQuery.Mvc.NET45.dll" /reference:"D:\a\1\s\Deals\Phase 3\DEV\ExternalReference\Korzh.EasyQuery.NET45.dll" /reference:"D:\a\1\s\Deals\Phase 3\DEV\ExternalReference\MatterDBLibrary.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll" /reference:"D:\a\1\s\MattersDB\DEV\External References\Newtonsoft.Json.dll" /reference:"D:\a\1\s\Deals\Phase 3\DEV\ExternalReference\Stikeman.Extension.Object.dll" /reference:"D:\a\1\s\Deals\Phase 3\DEV\ExternalReference\Stikeman.Extension.String.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.ComponentModel.DataAnnotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Configuration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.EnterpriseServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Net.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Runtime.Caching.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Security.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.ServiceModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Web.Services.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize- /out:obj\Release\MatterDBLibrary.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /resource:obj\Release\Stikeman.MatterDB.Library.Properties.Resources.resources /target:library /utf8output Constant.cs DataModel\EntityAttributes.cs DataModel\Enum.cs DataModel\Operators.cs DataModel\SavedSearchModel.cs DataModel\SearchModel.cs DataModel\SearchQueryModel.cs ImpersonateManager.cs MatterDBBuilder.cs MatterDBController.cs MatterDBPersistor.cs MatterLockException.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs DataModel\SearchResultModel.cs "Service References\ContactServices\Reference.cs" "Service References\EmployeeServices\Reference.cs" "Service References\EthicalWallServices\Reference.cs" UserNotFoundException.cs Utils.cs "Web References\IntAppServices\Reference.cs" "C:\Users\VssAdministrator\AppData\Local\Temp\.NETFramework,Version=v4.6.AssemblyAttributes.cs"
2019-06-24T17:37:09.4348317Z Using shared compilation with compiler from directory: C:\Program Files (x86)\MSBuild\14.0\bin
2019-06-24T17:37:10.0330700Z ##[warning]MattersDB\DEV\MatterDBLibrary\ImpersonateManager.cs(7,40): Warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'
2019-06-24T17:37:10.0331697Z ImpersonateManager.cs(7,40): warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.' [D:\a\1\s\MattersDB\DEV\MatterDBLibrary\MatterDBLibrary.csproj]
2019-06-24T17:37:10.0332924Z ##[warning]MattersDB\DEV\MatterDBLibrary\ImpersonateManager.cs(8,35): Warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'
2019-06-24T17:37:10.0333757Z ImpersonateManager.cs(8,35): warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.' [D:\a\1\s\MattersDB\DEV\MatterDBLibrary\MatterDBLibrary.csproj]
MattersDB\DEV\MatterDBLibrary\DataModel\SearchQueryModel.cs(1,25): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\MatterDBBuilder.cs(14,25): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\MatterDBController.cs(18,31): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\MatterDBController.cs(17,25): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\MatterDBPersistor.cs(9,25): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\MatterDBPersistor.cs(10,25): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\DataModel\SearchResultModel.cs(1,25): Error CS0234: The type or namespace name 'BusinessEntities' does not exist in the namespace 'Stikeman.MatterDB' (are you missing an assembly reference?)
MattersDB\DEV\MatterDBLibrary\DataModel\SearchResultModel.cs(37,16): Error CS0246: The type or namespace name 'NamedObject' could not be found (are you missing a using directive or an assembly reference?)
MattersDB\DEV\MatterDBLibrary\DataModel\SearchQueryModel.cs(41,21): Error CS0246: The type or namespace name 'NamedObject' could not be found (are you missing a using directive or an assembly reference?)
MattersDB\DEV\MatterDBLibrary\DataModel\SearchQueryModel.cs(152,16): Error CS0246: The type or namespace name 'NamedObject' could not be found (are you missing a using directive or an assembly reference?)
提前致谢。
【问题讨论】:
-
究竟是什么错误?你能分享一下构建管道吗?
-
添加了额外的日志信息。
标签: build azure-devops continuous-integration