Ling
Ling

Reputation: 25

Visual Studio 2017 Prevent Ignore of Packages folder on pending changes TFVS

Currently Visual Studio 2017 seems to ignore the packages folder by default when reviewing pending changes so I have to manually add them which can be time consuming - The trouble is that I actually want to commit nuget packages into source control via TFVS. I understand that this isn't the 'correct' way of doing things (nugets should be pulled via nuget restore). But unfortunately with the solution I am currently working on packages are committed into source control. Is there a global ignore configuration I can amend to allow package changed to be auto detected?

Thanks.

Upvotes: 1

Views: 3155

Answers (2)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30372

To achieve that globally, you can edit the default ignore configuration file "LocalItemExclusions.config" to let VS 2017 to detect the packages files automatically.

Please follow below steps to do that:

1, Open the LocalItemExclusions.config file which under below path (You need to make sure open the folder that matches your VS version, VS 2017 should be 7.0) :

"C:\Users\{youraccount}\AppData\Local\Microsoft\Team Foundation\x.0\Configuration\VersionControl" 

2, Remove the default ignored files' extension then save the file,*.dll for example here:

 <Exclusion>*.dll</Exclusion>

3, Thus VS 2017 will detect the new added package files automatically, you can check them in Pending Changes page (Excluded Changes area )

4, Click the Detected link, click Promote, then check in the changes.

Upvotes: 1

Emiel Koning
Emiel Koning

Reputation: 4225

You could add a .tfignore file to the solution root (on the same level as your packages folder)

.Add a line !\packages to this file to explicitly re-include it.

The pending changes list in VS will take this file into account. The packages folder should now be listed to be added to source control.

Upvotes: 1

Related Questions