-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable dotnet add package with CPM #13009
Comments
@delanym I'm sorry you're experiencing this issue. I am not able to reproduce the problem: Directory.Packages.props: <Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project> Example.csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
</Project>
Then after, this is what I see in <Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Testcontainers.MsSql" Version="3.6.0" />
</ItemGroup>
</Project> And this is <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Testcontainers.MsSql" />
</ItemGroup>
</Project> I'm using .NET SDK 7.0.403. Can you confirm that your |
|
With the following folder structure,
Are you able to ZIP up an example with it not working so we can investigate? |
The same command works on Windows but it fails to detect CPM on Linux. |
What version of the .NET SDK are you using on Linux? If you're using the version that's available in RedHat or Ubuntu's own distribution, they use .NET's "source build", which for reasons I don't understand is limited to "1xx" SDK versions (7.0.1xx, 6.0.1xx). The fix in NuGet was added in NuGet 6.5, and according to the release notes for NuGet 6.5, it's part of the 7.0.200 SDK. Therefore, on Linux, unless you're using Microsoft's packages.microsoft.com, you're probably running an older version of the SDK that doesn't yet have CPM support. |
read above pls zivkan |
I just tested on Ubuntu 22.04 under WSL2, and it worked for me 🤷 |
I think there is an issue with .NET test projects related here. I am not on a computer but there's an issue with this exact pattern somewhere in a dotnet repo or our repo by @richlander. Specifically test projects are not following CPM practices and therefore blocks people from using it. Here's mine I think mentioned here: #12768 (comment) |
@delanym I think @JonDouglas is right, does your project have versions defined in it already for these packages:
You'll need to remove the Unfortunately, the existing project templates don't know about CPM and they add versions, we're tracking the work to get project templates updated here: #12967 |
This is the change to one project - <PackageReference Include="Core.System.Configuration.Install"/>
- <PackageReference Include="Microsoft.CSharp"/>
- <PackageReference Include="Microsoft.OpenApi"/>
- <PackageReference Include="Newtonsoft.Json"/>
- <PackageReference Include="System.ComponentModel.Annotations"/>
- <PackageReference Include="System.Configuration.ConfigurationManager"/>
- <PackageReference Include="System.Data.DataSetExtensions"/>
- <PackageReference Include="System.Data.SqlClient"/>
- <PackageReference Include="System.Diagnostics.EventLog"/>
- <PackageReference Include="System.Management"/>
- <PackageReference Include="System.Runtime"/>
- <PackageReference Include="System.ServiceProcess.ServiceController"/>
+ <PackageReference Include="Core.System.Configuration.Install" />
+ <PackageReference Include="Microsoft.CSharp" />
+ <PackageReference Include="Microsoft.OpenApi" />
+ <PackageReference Include="Newtonsoft.Json" />
+ <PackageReference Include="System.ComponentModel.Annotations" />
+ <PackageReference Include="System.Configuration.ConfigurationManager" />
+ <PackageReference Include="System.Data.DataSetExtensions" />
+ <PackageReference Include="System.Data.SqlClient" />
+ <PackageReference Include="System.Diagnostics.EventLog" />
+ <PackageReference Include="System.Management" />
+ <PackageReference Include="System.Runtime" />
+ <PackageReference Include="System.ServiceProcess.ServiceController" />
+ <PackageReference Include="Testcontainers.MsSql" Version="3.6.0" /> and another test project - <PackageReference Include="Microsoft.NET.Test.Sdk"/>
- <PackageReference Include="Moq"/>
- <PackageReference Include="MSTest.TestAdapter"/>
- <PackageReference Include="MSTest.TestFramework"/>
- <PackageReference Include="NLog"/>
- <PackageReference Include="System.Data.SqlClient"/>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" />
+ <PackageReference Include="Moq" />
+ <PackageReference Include="MSTest.TestAdapter" />
+ <PackageReference Include="MSTest.TestFramework" />
+ <PackageReference Include="NLog" />
+ <PackageReference Include="System.Data.SqlClient" />
+ <PackageReference Include="Testcontainers.MsSql" Version="3.6.0" /> |
@delanym Are you able to create a repro I can use to investigate further? A github repository or attached ZIP will help us understand better what's going on. |
This issue has been automatically marked as stale because we have not received a response in 14 days. It will be closed if no further activity occurs within another 14 days of this comment. |
NuGet Product Used
dotnet.exe
Product Version
7.0.402
Worked before?
No response
Impact
It's more difficult to complete my work
Repro Steps & Context
If I use CPM to control package versions I'm unable to add a package with this command
dotnet add package Testcontainers.MsSql
I expect to still be able to add a package.
Verbose Logs
No response
The text was updated successfully, but these errors were encountered: