Open a-einstein opened 4 years ago
Just to confirm, are you actually using the UnitTestFramework in your code? I expect if a Restore would fail due to incompatible TFMs, we may not know that at the time of the PackageReference migration.
//cc: @rrelyea
PackageReference has better restrictions for invalid packages compared to packages.config.
And the package vs.qualitytools.unittestframework is such an invalid package. Peaking at the packages content I see:
vs.qualitytools.unittestframework\15.0.27323.2\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Notice how the folder name is the name of the dll. Related https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5101
The correct way to author this package would be:
lib\
\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
For example:
lib\net472\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
At migration time, NuGet was unable to install the package in question and it was supposed to fail.
As you correctly observed, there was no report/no indication that something went wrong and that's a bug in the migrator.
Given your repro, if I remove the faulty package then everything works (as you've already observed), so if possible, you can consider not depending on that package. If you really need the functionality of the package, you can:
You've already indicated that you are unblocked though, just wanted to clarify your options :)
Given all this, we'll keep this issue open as a migrator bug.
I believe this could be a regression in a recent release of the migrator/Visual Studio. In previous versions, I would get a warning for packages that contained only a lib folder (which would require lib/Net45 for example), but in the most recent versions I am no longer seeing those packages show as compatibility issues. When migrating in the latest visual studio version, I get behavior similar to @a-einstein. No packageReferences are created in the project file.
@v-luzh
Can you please try to validate this report with the latest stable NuGet (VS 2019.6)
Hi @nkolev92, this issue still repro (didn't have the report, all packages disappeared in PM UI, and the "Packages.config" file disappeared) on VS Master\30126.103 + NuGet Client Dev\5.7.0.6623. But we got error NU1202 in the Error List window to show the incompatible TFM as below screenshot.
Thanks @v-luzh
@jjmanton are you seeing something different from what @v-luzh's repro does? I think the lack of a report is the obvious bug. I am just trying to understand if there's any other bugs that we might be missing.
@nkolev92 I think 16.6 partially fixed the issue. Here is what I observed -
Note that the package compatibility box is still empty, which is a bug. I am not getting warnings about install.ps1, and missing TFM folder under lib. The web report comes up fine, and package references are correctly added to the csproj. Strangely though, my packages with lib only folder hierarchy are working fine. Was this a change recently? This used to fail.
Note that the package compatibility box is still empty, which is a bug.
Yep, that's the main issue we've observed here :)
I am not getting warnings about install.ps1, and missing TFM folder under lib. The web report comes up fine, and package references are correctly added to the csproj. Strangely though, my packages with lib only folder hierarchy are working fine. Was this a change recently? This used to fail.
No change with install.ps1 and missing tfm folder warnigns. The warnings should've been displayed and no compatibility changes have been made.
I still have that problem is VS 2022. To reproduce
The workaround is to reference MSTest.TestAdapter and MSTest.TestFramework packages instead.
Details about Problem
NuGet product used: VS UI. 'Migrate packages.config to PackageReference' on a packages.config of a Test project.
NuGet version: 5.4.0
dotnet.exe --version: 4.8
VS version: 16.4.1.
OS version: Windows 10 version 1909 build 18363.476
Worked before? If so, with which NuGet version: Yes, on other projects.
Detailed repro steps so we can see the same problem
I have this package file.
Also see the analysis screen shot.
Call the migrator. I get a good analysis as it seems.
Apply.
Used the NuGet package manager to manually install the top level dependencies.
Added UnitTestFramework as a simple reference. Found in Visual Studio 2019.
Sample Project
Did not succeed in Firefox. Done in bare Pale Moon. RCS.WpfShop.TestGui.zip
Conclusion
So, it seems a matter of handling such a case by the migrator.