Placement of .gitignore depends if the files need to be ignored for just one repo or for all your repos.
For one repo, place it in the root of your repo.
When you create a .gitignore file in an existing repo, or add files that were already in the repo, you have to make sure to remove the to-be-ignored files from the repo.
If you have a test.dll in the root, you have to do
git rm --cached test.dll
Now if you have a lot of files, like you said you can opt for the following option, remove everything from the cache, add it all back (the files in .gitignore will not be added) and commit everything again.
git rm -r --cached .
git add .
git commit -m "Start using .gitignore"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…