Skip to content
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

Allow changing the path for NuGet.config and packages.config in Settings screen. #195

Closed
XtroTheArctic opened this issue Oct 19, 2018 · 12 comments

Comments

@XtroTheArctic
Copy link

Please allow changing the path for NuGet.config and packages.config in Settings screen. Hard coded paths in Unity plugins are HORRIBLE! :(

I'll fork the repo and change the path manually for now. I hope you can add this feature so I don't have to update my fork for eternity.

@jwittner
Copy link
Collaborator

Can you lay out your use case for other config file locations? Not opposed to it, just want to understand it.

Any change you want to make a PR with this functionality?

@jwittner jwittner changed the title Please allow changing the path for NuGet.config and packages.config in Settings screen. Hard coded paths in Unity plugins are HORRIBLE! Please allow changing the path for NuGet.config and packages.config in Settings screen. Oct 19, 2018
@jwittner jwittner changed the title Please allow changing the path for NuGet.config and packages.config in Settings screen. Allow changing the path for NuGet.config and packages.config in Settings screen. Oct 19, 2018
@XtroTheArctic
Copy link
Author

I (probably many other Unity developers too) don't like to keep individual files (especially the ones don't belong to me directly) in the Unity project root (Assets folder). When I import a 3rd party asset, I move its main folder to 3rdParty folder to keep the Unity root clean.

I did the same thing for NuGetForUnity's main folder. I moved it to 3rdParty folder. But the config files are created in the root automatically by NuGetForUnity dll. I'd like to be able to move them to another folder. Maybe not to 3rdParty folder because it's not a folder for storing config files but maybe I can move the config files to Assets/NuGet folder. To be able to do that, I would like to set the config path in NuGet settings in Unity's preferences window.

@wombatzus
Copy link

Another vote for making the path to the config files configurable and here is my reason: other tools don't like this location. For instance Rider doesn't discover the config files here under Assets but works fine if they are one level up, at the same level as the solution.

@c0nstexpr
Copy link

Is there any progress for this enhancement?

@jwittner
Copy link
Collaborator

Not that I've seen. We're open to any PRs though if you'd like to make the changes. =)

@JoC0de
Copy link
Collaborator

JoC0de commented Apr 8, 2023

The main problem in making it configurable is: where to store the configuration with the information where to find the config file (its a 🐔 🥚 problem) 😄

@JoC0de
Copy link
Collaborator

JoC0de commented Aug 12, 2023

Duplikate of #527
At least the packages.config file can now be moved #551

@mwgray
Copy link

mwgray commented Nov 6, 2023

Odin Inspector gets around this problem by using the guids in meta files. Basically they have a hard coded guid in their codebase to use as a marker to find a directory. Source isn't available, but I believe they use this class to create a scriptable object Odin Inspector/Assets/Editor/OdinPathLookup.asset, which has a guid of 08379ccefc05200459f90a1c0711a340.

Then the path can be looked up by AssetDatabase.GUIDToAssetPath("08379ccefc05200459f90a1c0711a340"), which can then assume that that file is in the expected location, and thus find the root folder of the distribution, no matter where it's placed within the 'Assets' folder.

For this issue, CreateDefaultFile could also write a default NuGet.config.meta alongside the default NuGet.config file, with a hard coded guid. Then ConfigurationManager could use the guid to find the file, which could then be moved anywhere within the project.

@igor84
Copy link
Collaborator

igor84 commented Nov 6, 2023

But we also have a Command Line Interface (CLI) version that needs to run outside of unity in automatic build systems and there is no cheap way to replicate GUIDToAssetPath there as far as I can see.

@mwgray
Copy link

mwgray commented Nov 6, 2023

Ah, if that's the case could the users that wish to move the config file simply pass in a CLI argument, ie --config_path, which defaults to the current behavior?

@JoC0de
Copy link
Collaborator

JoC0de commented Nov 11, 2023

What we can do is provide two "hardcoded" locations where the NuGet.config file can be placed.

  • Assets/NuGet.config (the currently used location)
  • ProjectSettings/Packages/com.github-glitchenzo.nugetforunity/NuGet.config (new location would disable the auto-reload feature)

@JoC0de
Copy link
Collaborator

JoC0de commented Dec 30, 2024

Implemented by #619

@JoC0de JoC0de closed this as completed Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants