-
Notifications
You must be signed in to change notification settings - Fork 263
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
dotnet test
on .NET Framework test suite requires runtime identifier?
#4469
Comments
Looking at that issue now |
@thomhurst could you please confirm the following behaviors:
It would seems to indicate this is a msbuild/SDK issue on building (which we call when doing @baronfel @JanKrivanek @YuliiaKovalova is it something you are aware of? |
Got a binlog of what happens when you call MSBuild @Evangelink? |
Here you go: msbuild.binlog.txt |
You're right. It happens on the build.
I managed to build in VS and then run on the CLI with --no-build like you suggested and that works fine:
|
Unfortunately it's not easily trackable from the binlog where that inital value comes from @YuliiaKovalova - this is another example where dotnet/msbuild#11106 will help a ton! |
But it seems to go from here: While not being used during Restore. @marcpopMSFT - could you suggest who should look at this? |
This is specific to TUNIT correct? From the binlog, it appears that HasRuntimeOutput is true for the build but not for the restore which is why a RID is getting set for the build but not project assets json gets created during the restore. This is happening because OutputType is ending up as an exe in the build but not during the restore. The restore downloads the tunit package which ends up setting the OutputType to exe after the restore phase in TUNIT.Engine.props. @rainersigwald @dsplaisted any suggestions how tunit can work around this? Do we need a property they can disable the implicit RID inference for netfx apps? They could set HasRuntimeOutput to false but I don't know what other side effects that'll have. |
@thomhurst I confirm that setting |
Ah that's good! But it looks like it's in an empty nested folder... Not sure why as it should be pulling through the TargetFramework
|
Anyway - This is a me problem. Sorry for the red herring. Thanks for the help everyone! |
@thomhurst just confirming - that structure would 100% interfere with the auto-loading behaviors of NuGet. Check for double-slashes in the PackagePath for the items you're bundling? |
This is the core of it--I think the other test packages require that the project itself set |
Yes, props and targets files in packages should not be setting any properties which would modify the input to Restore, which includes the OutputType. |
One reason why custom MSBuild SDKs are good. When using it, we can actually set the output type in the props and everything works fine while for a normal package we have this error. |
Weird. This has been in TUnit for ages and doesn't seem to affect .NET (Core) builds? Only for .NET Framework has it not worked. I'd really like to be able to abstract away all the properties from users to simplify things for them. |
@thomhurst for what it's worth IMO some properties are better left in the project. I wouldn't typically expect a |
@AArnott I think @bradwilson is doing the same for xUnit. I do tend to think it's more expected for test because with the new platform each test app has to be an executable so it feels boilerplate. But again we saw similar problem in MSTest and that's why we went with output type set by user for normal nuget and automatically set when using MSTest.Sdk custom MSBuild SDK. Fyi I'll be having some discussions next week for the possibility to have some generic test SDK linked to the new platform. |
I'd recommend that the NuGet package validate the exe requirement but not try to impose it (for this reason that it does other stuff). |
How would I do this? |
Something like (untested) <Target Name="ValidateExeProject"
BeforeTargets="BeforeBuild"
Condition="'$(BuildingProject)' == 'true'">
<Error Condition="'$(OutputType)' != 'Exe'"
Text="TUnit test projects must have OutputType Exe as of version XXX" />
</Target> |
I'm happy to do this for xUnit.net as well, but I have no idea what My temptation is to use |
Echoing brad. Also does this go in the props/targets file too? |
Also, This puts things in a weird position: you'll get a notification for .NET Framework projects, but not .NET projects, and also the .NET projects aren't actually building executables despite trying to hard-set |
Im struggling with props files on net framework ATM. Net core I put files in build transitive and it works great I'm trying just build for net framework and not getting the results I expect. |
Edit: I'm able to fix the lack of AppHost by injecting |
v3 |
Is this anything to do with testing platform?
I've just added .NET Standard support to TUnit, and if I do a normal
dotnet test
it doesn't run unless I pass in a runtime identifier too.Original issue is here: thomhurst/TUnit#1465
dotnet test:
dotnet test -r win-x86:
The text was updated successfully, but these errors were encountered: