4

I'm on VS Community 2017.

I'm trying to permanently ignore the packages folder from being checked-in. I went to Source Control Explorer, but the Cloak option in the file/folder's context menu, under Advanced is grayed out:

enter image description here

I tried adding a .tfignore file in the root folder adding packages and /packages to it, but it didn't do the job.

Any ideas?

Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632

2 Answers2

4

Cloaking is the process of defining which folders or files should be ** ignored by the workspace on your development machine.**

Which may not be suitable for your situation. You could only cloak files/folders already in source control. If your packages folder is newly add in pending changes and not checked in, the cloak option should be grayed out.

Give a try with declaring below instead of only ignore \packages in your .tfignore file and add a disableSourceControlIntegration in a NuGet.config file, try again.

\packages
!\packages\repositories.config

For more detailed steps please refer to this question: Get TFS to ignore my packages folder

Another way is only check the packages folder to TFS (without any files or sub-folders) and then do the cloaked operation.

More info about the nuget package restore/TFS please refer this tutorial-- Package Restore with Team Foundation Build

Outman
  • 3,100
  • 2
  • 15
  • 26
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 1
    [This](https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore#package-restore-with-team-foundation-build) link was most helpful, please include this in your answer. What did the trick was the .nuget\NuGet.config file. – Shimmy Weitzhandler Aug 23 '17 at 22:16
1

You can only cloak things that are committed to the server already and since you have a pending add on the packages folder, it is not.

The package folder is added byt the Package Manager, but you can configure it to skip that step by creating a NuGet.config file in the solution directory setting disableSourceControlIntegration to true.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <solution>
        <add key="disableSourceControlIntegration" value="true" />
    </solution>
</configuration>
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
Tore Østergaard
  • 4,362
  • 3
  • 27
  • 43