-
Notifications
You must be signed in to change notification settings - Fork 155
Test projects do not convert correctly and result in TestContainer was not found error #173
Comments
Initial look at this suggests that it is an MSTest issue. The version of MSTest being used fails to load on .NET Core but succeeds on framework |
Hi @jmarolf, thanks for investigating. Is this something that needs to be raised with the MSTest team? Thanks |
Hi @tomaustin700, Could you verify if the issue is still happening or was it fixed in the meantime? |
Hi @dotnokato
How are you running try convert? I am using the Thanks. |
Hi @tomaustin700 And I was able to reproduce the issue looking at it again. try-convert finishes successfully, but the output project is not a test project. An attempt to run tests from this output project result with the exception as shown by you in Output > Tests window. After some debugging I found that this project is identified as ProjectStyle.WindowsDesktop instead of ProjectStyle.MSTest in GetProjectStyle() method in MSBuildWorkspace class. |
Yeah, this is a bug. The code currently assumes that it's a desktop app since it has these references https://github.com/tomaustin700/TestConvertIssue/blob/f5a7e30e2bc466171daef63cc0904282d7950058/PatientLedger.PatientLedgerTests/Ledger.PatientLedgerTests.csproj#L70-L75 The correct thing to do would be to adjust this routine to default to test if it has the test references regardless of if it has windows references. try-convert/src/MSBuild.Abstractions/MSBuildWorkspace.cs Lines 199 to 215 in 2641e96
Probably a pretty simple fix. We look at references and make some assumptions since that's about the best that can be done in conversion tooling, so I suppose a targeted adjustment here is enough. @tomaustin700 @dotnokato would either of you be interested in submitting a PR? More than happy to review. Also thanks to both of you for investigating this. |
Hi @cartermp I am happy to work on a PR for that. One additional question: |
@dotnokato In this case I think the logic you're pointing out here is correct (could be wrong...). The thinking when I wrote that code was that those references will not work correctly for .NET Core-based tests unless the WindowsDesktop SDK is also set. However, the code in MSBuildWorkspace doesn't correctly handle this, so it ends up causing a problem. |
@cartermp OK, I've removed the change to ProjectRootElementExtensions.cs from the pull request. Please review and let me know if you want anything changed. |
Thanks for resolving this @dotnokato. |
Hi,
I am attempting to convert a .net framework test project to core and I am running into the following issue. Once converted the project shows as a class library and no tests seem to be discovered. When a test is ran manually the test output is the following:
I have uploaded a sample solution here: https://github.com/tomaustin700/TestConvertIssue
I am building try-convert locally as the current released version is missing the following fix #156
The text was updated successfully, but these errors were encountered: