ArchUnitNET icon indicating copy to clipboard operation
ArchUnitNET copied to clipboard

How to check package references?

Open ChangeTheCode opened this issue 3 years ago • 2 comments

Hi I have a question about the package references. I want to check that my project has only two references nuget packages. How can I write a test to garantiere this?

Has someone a code snipped for such a test?

ChangeTheCode avatar Nov 02 '22 09:11 ChangeTheCode

Hi @ChangeTheCode ,

if you refer to the .csproj file when you say "my project" then I would assume that you need a different approach, e.g. parsing the file (it's XML) and assert it's content correspondingly in a unit test. The architecture tests operate on a compiled assembly, not on individual project(s).

MSinstein avatar May 05 '23 15:05 MSinstein

So with ArchUnitNET you can test if nuget Types are used in forbidden layer?

ghost avatar Jan 11 '24 10:01 ghost

As @MSinstein said, actually verifying whether a packaged is referenced in the actual project file is beyond the scope of ArchUnitNET. I'm closing this in favour of #130 which from my understanding covers what you are trying to achieve. Feel free to reopen this issue if you have any other questions.

alexanderlinne avatar Aug 28 '24 18:08 alexanderlinne