For a .Net project, what file extensions should I

2020-07-18 11:16发布

Everytime I start a project I have to think carefully about which files to exclude from source control. Has someone made a list of the criteria so I can look it up from the beginning? I work on my own so I have not got round to it. I appreciate that in the case of a DLL, you would want to include some and exclude others, so it is not just dependent on the file extension. My projects are ASP.Net, although a general discussion of other templates would also be useful.

5条回答
闹够了就滚
2楼-- · 2020-07-18 11:47

Generic ingores from a project folder:

*.Cache
*.user
bin
obj

And from the solution (a level up)

*.cache
_PublishedWebSites
*.suo

We've also got the following - which are instance specific config settings referenced out of generic configs (i.e. web.config for asp.net apps)

AppSettings.config
Provider.config
connections.config

There are .config.sample files that are version controlled.

You should probably set bin, obj, *.cache, *.user and *.suo as global in your subversion setup - but as this is (if memory serves) machine specific you're probably going to end up doing explicit ignores anyway

查看更多
等我变得足够好
3楼-- · 2020-07-18 11:49

Do not sourcecontrol bin and obj folders, as well as *.suo and *.user (if you're using Visual Studio) files.

If you feel uneasy about keeping third-party DLLs in source control, try Componento, which, granted, does not yet have a sizable components database.

查看更多
走好不送
4楼-- · 2020-07-18 11:53

If you use ReSharper, be sure to exclude _Resharper* folders

If you're using Subversion for source control then the VisualSVN Visual Studio plug-in will manage excludes for you automatically.

Be sure to include any third-party dlls that your project references that won't be in the GAC of your build or deployment machines. Our practice is to have a lib folder that all such dlls live in, and we add references to them from that folder. This ensures that the hintpath property in the csproj file is correct (it stores a relative path to the referenced dll).

查看更多
男人必须洒脱
5楼-- · 2020-07-18 11:57

As a general rule, only source control files which are required to build the application.

查看更多
萌系小妹纸
6楼-- · 2020-07-18 12:03

From http://blog.goneopen.com/2009/06/git-excludes-for-dotnet/:

.DS_Store
._*
TestResults
*Resharper*
**.ReSharper**
**\_ReSharper.**
*.bak
*.cache
*.resharperoptions
*.suo
*.user
*.vsprops
*/TestResults
*\bin*
*\obj*
_ReSharper.*
查看更多
登录 后发表回答