C
Join ServerC#
help
✅ [.NET 7.02] Nuget Dependency version conflict
OOptoCloud1/23/2023
I got this trying to build my project, I'm trying to understand it but cant figure out which two dependencies which collide :c
I'm also on .NET 7, but it sais .NET 6 in here?
I'm also on .NET 7, but it sais .NET 6 in here?
Found conflicts between different versions of "Microsoft.EntityFrameworkCore.Relational" that could not be resolved.
There was a conflict between "Microsoft.EntityFrameworkCore.Relational, Version=7.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.EntityFrameworkCore.Relational, Version=7.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
"Microsoft.EntityFrameworkCore.Relational, Version=7.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.EntityFrameworkCore.Relational, Version=7.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not.
References which depend on "Microsoft.EntityFrameworkCore.Relational, Version=7.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\eirik\.nuget\packages\microsoft.entityframeworkcore.relational\7.0.1\lib\net6.0\Microsoft.EntityFrameworkCore.Relational.dll].
C:\Users\eirik\.nuget\packages\microsoft.entityframeworkcore.relational\7.0.1\lib\net6.0\Microsoft.EntityFrameworkCore.Relational.dll
Project file item includes which caused reference "C:\Users\eirik\.nuget\packages\microsoft.entityframeworkcore.relational\7.0.1\lib\net6.0\Microsoft.EntityFrameworkCore.Relational.dll".
C:\Users\eirik\.nuget\packages\microsoft.entityframeworkcore.relational\7.0.1\lib\net6.0\Microsoft.EntityFrameworkCore.Relational.dll
References which depend on "Microsoft.EntityFrameworkCore.Relational, Version=7.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [].
H:\Source\web\Opto\backend\bin\Debug\net7.0\Server.dll
Project file item includes which caused reference "H:\Source\web\Opto\backend\bin\Debug\net7.0\Server.dll".
H:\Source\web\Opto\backend\bin\Debug\net7.0\Server.dll

Ttebeco1/23/2023
show the enitre csproj
OOptoCloud1/23/2023
both?
OOptoCloud1/23/2023
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Server</AssemblyName>
<RootNamespace>Opto</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1591;1701</NoWarn>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="7.0.0" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.2" />
<PackageReference Include="AWSSDK.S3" Version="3.7.101.58" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="7.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.26.0" />
<PackageReference Include="NetMQ" Version="4.0.1.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.1" />
<PackageReference Include="PreMailer.Net" Version="2.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>
<Target Name="openapi" AfterTargets="Build">
<Message Text="generating openapi" Importance="high" />
<Exec Command="dotnet tool run swagger tofile --yaml --output $(ProjectDir)..\frontend\api\openapi.yaml $(OutputPath)$(AssemblyName).dll v1" />
</Target>
</Project>
Mmtreit1/23/2023
Should be able to just add an explicit PackageReference to the newer version in your project.
Mmtreit1/23/2023
To resolve the conflict.
Ttebeco1/23/2023
dotnet list package --outdated
OOptoCloud1/23/2023
PS H:\Source\web\Opto> dotnet list package --outdated
The following sources were used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
The project `H:\Source\web\Opto\frontend\Frontend.esproj` uses package.config for NuGet packages, while the command works only with package reference projects.
The given project `Backend` has no updates given the current sources.
The given project `Backend.Tests` has no updates given the current sources.
Ttebeco1/23/2023
🤔
OOptoCloud1/23/2023
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.1" />
OOptoCloud1/23/2023
could that be the issue?
Ttebeco1/23/2023
yes
Ttebeco1/23/2023
"could"
OOptoCloud1/23/2023
doesnt help if i downgrade all the packages to 7.0.1
Ttebeco1/23/2023
i don't see any reference in that csproj to
EFCore
BTWTtebeco1/23/2023

Ttebeco1/23/2023
thing is ... it's
>= 7.0.1 && < 8.0.0
Ttebeco1/23/2023
so it ... SHOULD be ok with 7.0.2
Ttebeco1/23/2023
The project H:\Source\web\Opto\frontend\Frontend.esproj
uses package.config for NuGet packages, while the command works only with package reference projects.
Ttebeco1/23/2023
wtf ?
OOptoCloud1/23/2023
how to do this?
Ttebeco1/23/2023
copy paste a line
Ttebeco1/23/2023
and directly edit it
OOptoCloud1/23/2023
eh?
OOptoCloud1/23/2023
just make it 7.0.2? that hasnt released yet for that package
Ttebeco1/23/2023
i don't think that's what @mtreit meant
Ttebeco1/23/2023
at least not that package
Mmtreit1/23/2023
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.2" />
OOptoCloud1/23/2023
ok that fixed it for local
OOptoCloud1/23/2023
lets see if it fixes it for github actions
Ttebeco1/23/2023
can you share all csproj ?
Ttebeco1/23/2023
assuming there's no sensitive stuff
Ttebeco1/23/2023
including the test one
OOptoCloud1/23/2023
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<AssemblyName>Tests</AssemblyName>
<RootNamespace>Opto.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\backend\Backend.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="DataSet\**" Exclude="DataSet\.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Remove="DataSet\Text\BlackList\Text\LeadingSpaces.txt" />
<None Remove="DataSet\Text\BlackList\Text\TrailingSpaces.txt" />
</ItemGroup>
</Project>
OOptoCloud1/23/2023
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/0.5.62-alpha">
<PropertyGroup>
<JavaScriptTestRoot>src\</JavaScriptTestRoot>
<JavaScriptTestFramework>Jest</JavaScriptTestFramework>
<!-- Command to run on project build -->
<BuildCommand>
</BuildCommand>
<!-- Command to create an optimized build of the project that's ready for publishing -->
<ProductionBuildCommand>npm run build</ProductionBuildCommand>
<!-- Folder where production build objects will be placed -->
<BuildOutputFolder>$(MSBuildProjectDirectory)\build</BuildOutputFolder>
<StartupCommand>npm run start</StartupCommand>
</PropertyGroup>
</Project>
Ttebeco1/23/2023
and you were just trying to add
Microsoft.EntityFrameworkCore.Relational
to Backend.csproj
right ?OOptoCloud1/23/2023
in the first place, no
OOptoCloud1/23/2023
but now i did yeah
Ttebeco1/23/2023
what were you doing that cause that :
MMODiX1/23/2023
OOptoCloud1/23/2023
tbh it happened in github workflows first
Ttebeco1/23/2023

OOptoCloud1/23/2023
then i somehow replicated it on my local computer
OOptoCloud1/23/2023
but idk how
Ttebeco1/23/2023
can you share your yml pipeline ?
OOptoCloud1/23/2023
name: test backend
# run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches: [ "main", "dev", "feature/*" ]
pull_request:
branches: [ "main", "dev" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET Framework SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
- name: Install dependencies
run: |
dotnet restore
dotnet tool restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Run tests
run: dotnet test --no-restore --verbosity normal
OOptoCloud1/23/2023
Oh
OOptoCloud1/23/2023
Keep in mind
OOptoCloud1/23/2023
I also have this:
OOptoCloud1/23/2023
global.json
{
"sdk": {
"version": "7.0.102",
"rollForward": "latestFeature"
}
}
Ttebeco1/23/2023

Ttebeco1/23/2023

OOptoCloud1/23/2023
uhhH?
Ttebeco1/23/2023
i'm full insider build buffed
OOptoCloud1/23/2023
right
OOptoCloud1/23/2023
uhm
OOptoCloud1/23/2023
🤔
Ttebeco1/23/2023
- name: Setup .NET Framework SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
Ttebeco1/23/2023
this uses the
global.json
OOptoCloud1/23/2023
yup
Ttebeco1/23/2023
so it should pull 7.0.102 SDK properly
Ttebeco1/23/2023
it's just your
${{ matrix.dotnet-version }}
that is not definedTtebeco1/23/2023
I mean I don't see any matrix
OOptoCloud1/23/2023
yeah forgot to remove that from the template i copied
Ttebeco1/23/2023
a ok
Ttebeco1/23/2023
but beside that ...
Ttebeco1/23/2023
I both don't understand
Ttebeco1/23/2023
and at the same time don't repro
Ttebeco1/23/2023
i copy pasted both csproj
Ttebeco1/23/2023
just ran a build on it
OOptoCloud1/23/2023
i can build it locally rn
OOptoCloud1/23/2023
but github cant
Ttebeco1/23/2023
sooooooooooooo
OOptoCloud1/23/2023

Ttebeco1/23/2023
ok so
Ttebeco1/23/2023
your logs
Ttebeco1/23/2023
they mentionned
Microsoft.EntityFrameworkCore.Relational
Ttebeco1/23/2023
i copied both of your csproj
Ttebeco1/23/2023
Microsoft.EntityFrameworkCore.Relational
does not even appear anywhereOOptoCloud1/23/2023
oh nvm now i have a weirder error
Ttebeco1/23/2023
so you have other csproj than
backend
and backend.test
?Ttebeco1/23/2023
because I saw something FUCKING DISTURBING
Ttebeco1/23/2023

OOptoCloud1/23/2023
MSBuild version 17.4.1+9a89d02ff for .NET
/usr/share/dotnet/sdk/7.0.102/Microsoft.Common.CurrentVersion.targets(1229,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/home/runner/work/Opto/Opto/frontend/Frontend.esproj]
Backend -> /home/runner/work/Opto/Opto/backend/bin/Release/net7.0/Server.dll
generating openapi
[2023-01-23 20:22:57.538] warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {b7f9451a-7835-49e1-98e9-8621b54ceb27} may be persisted to storage in unencrypted form.
Swagger JSON/YAML successfully written to /home/runner/work/Opto/Opto/backend/../frontend/api/openapi.yaml
Backend.Tests -> /home/runner/work/Opto/Opto/backend.tests/bin/Release/net7.0/Tests.dll
Build FAILED.
/usr/share/dotnet/sdk/7.0.102/Microsoft.Common.CurrentVersion.targets(1229,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/home/runner/work/Opto/Opto/frontend/Frontend.esproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:12.39
OOptoCloud1/23/2023
Ttebeco1/23/2023
what in the hell is that lol
OOptoCloud1/23/2023
i dont know
OOptoCloud1/23/2023
github copilot spit it out
Ttebeco1/23/2023
the
Microsoft.AspNetCore.DataProtection.KeyManagement
is fineOOptoCloud1/23/2023
new vs thingy
Ttebeco1/23/2023
this is a warning that happen for data encryption if you did not configured it properly
Ttebeco1/23/2023
it will fuck up your data protection ciphered value the moment you scale out though 😄
OOptoCloud1/23/2023
i cant remember messing with any xml encryption or any encyption at all
Ttebeco1/23/2023
the identity stack does
Ttebeco1/23/2023
for generating / protecting / signing JWT in cookie server side
OOptoCloud1/23/2023
i specifically want identity long gone
Ttebeco1/23/2023
it's used so that the cookie can be read back
OOptoCloud1/23/2023
>/usr/share/dotnet/sdk/7.0.102/Microsoft.Common.CurrentVersion.targets(1229,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/home/runner/work/Opto/Opto/frontend/Frontend.esproj]
OOptoCloud1/23/2023
oh
Ttebeco1/23/2023
sooooo