简体   繁体   中英

Changing packages.config to somethingelse.config

I created an ASP.NET MVC 4.5 application.
Now I want to change packages.config to mypackages1.config. A simple renaming of the file.

I edited .csproj file and renamed as mentioned.
I renamed packages.config file as mentioned.
I edited repositories.config and made changes as mentioned.

But, when I issued Install-Package somepackage, it created a new packages.config file.

Is there a way I can rename my packages.config file? I don't yet have .nuget folder in my solution.

This is not supported. You cannot change the packages.config file to any arbitrary name.

The only thing NuGet supports is to have the packages.config file named after the project file itself. This allows multiple project files (.csproj) to be in the same directory. So if your project is called FooBar.csproj you can have a packages.config file named:

packages.FooBar.config

Try to enable nuget package restore for your solution, then the nuget folder will be created. In the Nuget.Targets file rename the packages.config to the name you altered. I haven't tried it out but try this may help you. Also you must make sure the newly downloaded must create an entry in that file alone not the packages.config it creates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM