Remove DeploymentItem for .NET Core in MSTest v5
I don't think this feature is reasonable for .NET Core. We should consider deprecating it for .NET Core in a future minor v4 release, and remove completely in v5.
Additionally, maybe we should even consider deprecating for .NET Framework when appdomain is not enabled.
I don't think the main motivation for the deprecation should be that appdomains don't exist in .NET Core. I've searched for deployment item mentions in multiple places, and I've never seen the internal details mentioned.
Instead we should understand what is the historical and intended usage of the attribute (IMHO the original intent is to isolate the binaries and files per test, so that the test can modify everything and not impact other tests).
That said searching for DeploymentItem on google will return two pages of results, all of those results complain about deployment item either being broken or non-obvious.
Websites and Articles
- .NET Core Unit tests – how to deploy files without using DeploymentItem
- DeploymentItem - A tale of the unexpected…
- .NET MSTest and DeploymentItem Attribute
- DeploymentItem attribute not working - Developer Community
- Test Runner - problem with DeploymentItem | DevExpress Support
- DeploymentItem for specific testmethod gets deploymentitems from other testmethods - Developer Community
- DeploymentItem results are inconsistent - NCrunch Forum
- .NET MSTest and DeploymentItem Attribute - DEV Community
- DeploymentItemAttribute Class | Microsoft Learn
- MSTest support: DeploymentItem? – ReSharper Support | JetBrains
- Deploying test data for MSTest
- MSTest, DeploymentItem, and the frustrating RelativePathRoot setting – sides of march
- Unit Testing - Deploy Files & Folders (Microsoft Visual Studio)One of them including this great excerpt:
https://just-about.net/deploymentitem-a-tale-of-the-unexpected/
Do you know how to separate the knowing from the naive, the pros from the amateurs and the men from boys? It’s just by their reaction in certain situations. It’s the cold shivering and slight cough they get if you just whisper a single word, a word like “DeploymentItem”.
So what causes these reactions? Mortals would call it an attribute in MS Test. The most demonic one I have to add.
I don't think the main motivation for the deprecation should be that appdomains don't exist in .NET Core.
My main motivation is that the feature wasn't designed or documented in a reasonable way, and it's very useless today. If we want to do it properly, I would consider as a completely new feature later when we have better design that is well understood in all scenarios.