4

Bit of a newbie question here.

In VC# 2010 Express, is there an easy way to prepare source code to be released? In other words, strip out any files that shouldn't be released like key files, user-specific settings, etc.

If not, can someone point me to a checklist or something of that nature?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
  • 1
    I've found a good rule of thumb to be "release whatever's under source control (except for source control metadata)" – Cameron Feb 04 '11 at 05:35
  • If you have your code under say SVN, you can simply use export. – leppie Feb 04 '11 at 05:55
  • I don't have any source control running currently. Does Express even come with anything like that? –  Feb 04 '11 at 05:57
  • @RobinHood70: You would have to use something external, but see my manual answer below. – leppie Feb 04 '11 at 05:59
  • @leppie: and if it's under Mercurial, you can use [`hg archive`](http://mercurial.selenic.com/wiki/TipsAndTricks#Make_a_clean_copy_of_a_source_tree.2C_like_CVS_export) – Cameron Feb 04 '11 at 06:06
  • @RobinHood70: You should look into using source control. Most source control systems are independent of Visual Studio. There's many good (free) ones to choose from: [Mercurial](http://hginit.com/) (my current favourite), [SVN](http://tortoisesvn.net/), [git](http://git-scm.com/), etc. – Cameron Feb 04 '11 at 06:25

3 Answers3

5

I don't know of a built-in way (though I've never looked for one); what to include will undoubtedly vary from project to project, and would be tricky to get right in an automated way. Here's a general list (off the top of my head) of what to include and exclude:

What to include

I've found a good rule of thumb to be "include whatever's under source control (except for source control metadata)". Basically:

  • All source code (C# files)
  • The solution file (.sln) and all project files (*.csproj)
  • Any libraries your code depends on to build and/or run (DLLs)
  • Any other files your project expects to be present at build- or run-time (e.g. app.config)
  • Documentation (any you've already got, plus some sort of README indicating how to build/run your project)
  • Satellite source files (e.g. installer scripts, custom tools, etc.)

What not to include

  • Binary builds of your project (i.e. the bin\Debug, bin\Release and obj folders) -- binaries should be released separately
  • Source control metadata (.svn folders, .hg folder, etc)
  • Per-user development settings and data (e.g. ReSharper folders, *.suo files, *.user files)
  • Intellisense files (*.ncb)

Key files are an interesting case -- if you're using one to create strongly-named assemblies, then you might or might not want to release that key file to the public. On one hand, it makes it easier for someone to make changes to your code and sign the resulting assembly, but on the other hand, someone could make malicious changes to your code then sign the assembly. See this question for a more complete discussion concerning whether to release key files or not.

This should cover most of the files in your project directory -- let me know if I've missed anything!

Community
  • 1
  • 1
Cameron
  • 96,106
  • 25
  • 196
  • 225
  • Truthfully, I'm looking at all three responses and just kind of combining them, but I've picked the most popular one and flagged it as the accepted answer. Thanks for all the tips everyone! –  Feb 04 '11 at 23:03
3

Here's what I normally do.

Delete all the following directories:

  • bin
  • obj

Delete the following files (recursively):

  • *.suo
  • *.gpstate
  • *.vssscc
  • *.csproj.user

That should give you a pretty clean project to be zipped up.

leppie
  • 115,091
  • 17
  • 196
  • 297
1

A good rule to follow is the rule list for a .gitignore file. See this answer for a good starting point.

Community
  • 1
  • 1
Greg Buehler
  • 3,897
  • 3
  • 32
  • 39