I have a MailService
package that uses Azure queues. I have put the queue related logic in a separate project. I'm using this in my pipeline to create a package that has both projects:
- task: NuGetCommand@2 displayName: "Pack MailService" inputs: command: 'pack' packagesToPack: '**/Testing.MailService.csproj' packDestination: '$(Build.ArtifactStagingDirectory)' versioningScheme: 'off' allowPackageConflicts: true includeReferencedProjects: true
This is how the generated package looks like in dotPeek.As you can see the main package MailService
references the queue one. The problem is that when I try using it in a different solution, I get the exception that Azure.Storage.Queues
is not found. I do see that it exists in the references of the Storage.Queues
project which is referenced by the first one. What exactly is the problem here?
These are my two project files
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net7.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><Version>1.0.0</Version></PropertyGroup><ItemGroup><PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" /><PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.3" /><PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" /><PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="7.0.0" /></ItemGroup><ItemGroup><ProjectReference Include="..\Testing.Storage.Queues\Testing.Storage.Queues.csproj" /></ItemGroup></Project>
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net7.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup><ItemGroup><PackageReference Include="Azure.Storage.Queues" Version="12.13.0" /><PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" /><PackageReference Include="Testing.Utilities.OperationResult" Version="1.4.6" /></ItemGroup></Project>
I did try this workaround. However, that broke my Azure pipeline with:
C:\Program Files\dotnet\sdk\7.0.201\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277: Found conflicts between different versions of "Azure.Core" that could not be resolved. [D:\a\1\s\src\Infrastructure\Testing.Functions\Testing.Functions.csproj]C:\Program Files\dotnet\sdk\7.0.201\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277: There was a conflict between "Azure.Core, Version=1.24.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8" and "Azure.Core, Version=1.28.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8". [D:\a\1\s\src\Infrastructure\Testing.Functions\Testing.Functions.csproj]C:\Program Files\dotnet\sdk\7.0.201\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277: C:\Users\VssAdministrator\.nuget\packages\azure.core\1.24.0\lib\net5.0\Azure.Core.dll [D:\a\1\s\src\Infrastructure\Testing.Functions\Testing.Functions.csproj]