Describe the bug
The test project is generated with two out of date NuGet packages: Microsoft.NET.Test.Sdk and xunit.runner.visualstudio. If you try to update them you get errors. This issue is only for the Microsoft.NET.Test.Sdk.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Packages are updated to the latest stable version.
Additional context
If you try to update the xunit runner the test project will no longer build.
Payload file '\.nuget\packages\xunit.runner.visualstudio\2.4.3\build\uap10.0.16299\xunit.runner.reporters.netstandard11.dll' does not exist.
This appears to be an issue with xunit: https://github.com/xunit/visualstudio.xunit/issues/221
Applies to the following platforms:
| UWP | WPF | WinUI |
| :--------------- | :--------------- | :---------------|
| Yes | ? | ? |
System
Workaround
Update the test project csproj file manually and add the missing NuGet package reference:
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>16.0.1</Version>
</PackageReference>
Update the NuGet package.
3. Update both packages.
Which are the two packages you refer to?
Is this Microsoft.NET.Test.sdk and xunit.runner.visualstudio
Just so I'm seeing what you're seeing.
The repro only appears to need to update xunit.runner.visualstudio to version 2.4.3
Yes, those are the two packages. Microsoft.NET.Test.Sdk also needs an update to 16.8.0
Related issue.
xunit.runner.visualstudio version 2.4.3 was released in August.
In September, _All_ NuGet packages were updated to the latest versions, but this was not included.
As there is no documentation of this being deliberately excluded from the update it must have been an error. How can periodic updated of ALL NuGet packages (done before each release) be checked to ensure that _ALL_ packages are included/updated appropriately?
Other UWP (WPF not checked) packages that don't appear to have been updated in September
Microsoft.NET.Test.Sdk is also not consolidated. The current (as of right now) templates in dev branch are a mixture of 16.0.1 and 16.7.1
X-Ref #3912
Yes, those are the two packages. Microsoft.NET.Test.Sdk also needs an update to 16.8.0
Apparently there is a reason this wasn't updated previously but it wasn't documented at the time.
This was my fault, sorry. When I looked into updating the nuget packages I had problems with some of the packages and found there were issues reported on the github of those packages, so I decided to not update and wait for those issues to get fixed. But @mrlacey is right that I should have called this out in the issue.
Microsoft.NET.Test.Sdk
The reason why there is a mixture of versions of the MSTest library is that on the UWP App testing projects this reference is resolved automatically by VisualStudio (thats also the reason why you can update it using the nuget package manager)
If you create a vanilla test app with VS you'll face the same problem. The workaround you suggested seems to be the official recomendation,
https://developercommunity.visualstudio.com/content/problem/901796/unable-to-update-microsoftnettestsdk-1601-1640-fro.html
Thanks for your help!
xunit.runner.visualstudio聽
I didn't update xunit.viusalstudio because I ran into issue https://github.com/xunit/visualstudio.xunit/issues/221. After updating Microsoft.NET.Test.Sdk to version 16.8.0 and xunit.runner.visualstudio to 2.4.1 I'm still seeing this issue, did this work for you?
Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.SqlServer
Wack tests fail when updating this library due to a dependency on Microsoft.Data.SQLClient (https://github.com/microsoft/WindowsTemplateStudio/issues/3756)
Recomendation for UWP was to use Microsoft.Data.SQLClient, but there seems to be a workaround now for UWP (https://github.com/dotnet/SqlClient/issues/703#issuecomment-713175899). Will open a separate issue for this.
Telerik.UI.for.UniversalWindowsPlatform
The latest version was published the day after updating the packages, that's why this wasn't included. We'll update it for Version 3.9
I was able to get xunit updated by first updating the test sdk and then updating the xunit runner. But after upgrading my app yesterday the problem has come back. Directly referencing all third party NuGet packages from the UWP app fixed it. But then after a few builds and some code changes it broke again. I think there is definitely a bug in 2.4.3.
I'm seeing the exact error message too. Have you found any other workaround?
Downgrading xunit.runner.visualstudio to 2.4.1 seem to resolve it.
The workaround for updating Microsoft.NET.Test.Sdk works fine on the emulator and tests, but when trying to add a MSTest App project on the nightly version packages are not installed.
Cannot modify an evaluated object originating in an imported file "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.Common.targets".
Going back to the original workaround of adding the reference to the cs proj seems to work fine:
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>16.8.0</Version>
</PackageReference>
Verified in dev-nightly:
Templates version: 0.22.20336.2
Wizard version: 0.22.20336.2
Most helpful comment
Downgrading
xunit.runner.visualstudioto 2.4.1 seem to resolve it.