Создание проектов библиотеки классов с помощью Devure Azure - PullRequest
0 голосов
/ 24 июня 2019

У меня есть решение с 3 проектами библиотеки классов (бизнес-логика, слои доступа к данным, веб-сервис).

Я могу построить решение в Visual Studio.

Однако, когда задача сборкизапускается в Azure DevOps, происходит сбой с ошибками, что пространство имен или тип не существует.Ошибка относится к одному из проектов библиотеки классов, который зависит от другого.

В чем здесь может быть проблема?

Вторая часть, когда я добавляю задачу сборки длявеб-приложение, как я могу убедиться, что веб-приложение может правильно ссылаться на DLLS из первой сборки решения проектов библиотеки классов (для правильной сборки)?

Ниже приведен отрывок из файла решения -Ошибка «not found» относится к проекту 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?)

заранее спасибо.

1 Ответ

1 голос
/ 25 июня 2019

Однако, когда задача компоновки выполняется в DevOps Azure, она завершается ошибкой из-за отсутствия пространства имен или типа.Ошибка относится к одному из проектов библиотеки классов, который зависит от другого.

Поскольку один из проектов библиотеки классов зависит от другого, поэтому для решения этой проблемы лучшее решениеэто добавить ссылку на проект для проекта библиотеки классов.Затем в задаче построения выберите файл решения .sln в параметре Решение:

enter image description here

Затем MSBuild / Visual Studio выберет для созданияссылочный проект сначала основывается на ссылочной связи в файле проекта, например <ProjectReference Include="..\TestReferenceApp\TestReferenceApp.csproj">, и копирует выходные данные в каталог ссылочного проекта.

Вторая часть этого процесса - когда я добавляю сборкузадача для веб-приложения, как я могу убедиться, что веб-приложение может правильно ссылаться на DLLS из первой сборки решения проектов библиотеки классов (для правильного построения)?

Так же, какОтветьте на первый вопрос, добавьте ссылку на проект в веб-приложение.Если добавление ссылки ограничено вами, вы можете сначала создать проекты библиотеки классов, а затем добавить задачу copy , чтобы скопировать библиотеку в выходные данные веб-приложения.Или вы можете упаковать проект библиотеки классов как пакет nuget, а затем добавить этот пакет nuget в веб-приложение.

Надеюсь, это поможет.

...