-
Notifications
You must be signed in to change notification settings - Fork 333
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
Using Microsoft.NET.Test.Sdk as GlobalPackageReference breaks the build #5116
Comments
It looks like non of the lib files are referenced, adding this test code: using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Project1.Tests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
} Which is a standard test class also tells me that TestClass and TestMethod does not exist. I could not find similar issue reported with GlobalPackageReference, but the nugets look standard, and we produce them from different workflows, so this looks more like the package management problem. @MichalPavlik have you seen such problem with global package management before? |
I can confirm I have reproduced the reported issue. Adding
Adding I know it is specific to CPM with global package references does not work for this package. |
GlobalPackageReference (surprisingly) does not work exactly like normal PackageReference, it is supposed to be dev time only. Here is full investigation on testfx repo: microsoft/testfx#5353 with solution that allows you to make it work like normal package reference. Here is an issue on nuget, describing that the feature is confusing and why, I would be glad if you read and confirm if my understanding of the confusion is correct. NuGet/Home#14223 |
Thanks. I have a better understanding now. As you mentioned, the name is rather confusing if we can't actually use it to reference compile assets. I'll stick with |
You can use it to reference compile time assets, and target you just need to do the customizations that are shown in the example project. :)
…-j
________________________________
Od: Richard Naud ***@***.***>
Odesláno: Tuesday, April 1, 2025 9:12:42 PM
Komu: microsoft/vstest ***@***.***>
Kopie: Comment ***@***.***>; State change ***@***.***>; Subscribed ***@***.***>
Předmět: Re: [microsoft/vstest] Using Microsoft.NET.Test.Sdk as GlobalPackageReference breaks the build (Issue #5116)
Thanks. I have a better understanding now. As you mentioned, the name is rather confusing if we can't actually use it to reference compile assets. I'll stick with PackageVersion then, too bad though, it means none of the projects will have the references by default, which is what I was looking for, to avoid pointing out the obvious to someone adding a new project (you forgot some refs). Oh well, better than nothing I guess.
—
Reply to this email directly, view it on GitHub<#5116 (comment)> or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABLYLYIN76PRWJQQ5CYSSW32XLQKVBFKMF2HI4TJMJ2XIZLTSOBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLLDTOVRGUZLDORPXI6LQMWWES43TOVSUG33NNVSW45FGORXXA2LDOOJIFJDUPFYGLKTSMVYG643JORXXE6NFOZQWY5LFVA3DENZXGQ3TENUCUR2HS4DFUVUXG43VMWSXMYLMOVS2UMRTGY3TMMZSGM4TNJ3UOJUWOZ3FOKTGG4TFMF2GK>.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Description
When using the package Microsoft.NET.Test.Sdk as GlobalPackageReference in a Directory.Packages.props the build fails with this error:
Using it as normal PackageReference in the .csproj works fine.
Steps to reproduce
<GlobalPackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
I created a small repo to demonstrate the issue:
https://github.com/proj-arch/Microsoft.NET.Test.Sdk-GlobalPackageReference-BuildError
Expected behavior
the project can be successfully built
Actual behavior
the build breaks with the error
Diagnostic logs
Since the build fails, I cannot run the tests with diagnostics.
Environment
The text was updated successfully, but these errors were encountered: