GlitchEnzo / NuGetForUnity

A NuGet Package Manager for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: can downloaded packages not be referenced by particular assemblies?

TrevorThoele2 opened this issue · comments

I am attempting to download test related NuGet packages like FluentAssertions. These packages should not be referenced by any other assemblies besides my test assembly. Is it possible to download a package such as FluentAssertions and have it be only referenced by my test assembly?

Hi @TrevorThoele2 ,
thanks for the question.
on option would be to set Override References on all your Assembly Definitions (.asmdef).
We also have the hidden feature (not available from the UI) that allows the NuGet package to be imported as not Auto Referenced. Just add the autoReferenced attribute to the package inside the packages.config.

<?xml version="1.0" encoding="utf-8" ?>
<packages>
  <package id="Serilog" version="2.12.0" manuallyInstalled="true" autoReferenced="false" />
</packages>

image

Awesome, thank you so much for this answer! I was able to have FluentAssertions only accessible from the test projects by utilizing the Override References option on my game assembly definition file and then bringing in FluentAssertions as an explicit assembly reference in my test assembly definition file. I really appreciate your help!

👍 that I could help you