views:

447

answers:

4

I need to add a C# solution with examples that would be distributed as part of a software library installer. This solution would have various examples on how to use the product's API.

I want to be able to display a simple "quick start" file explaining how to run the examples when the solution is opened in Visual Studio.

Is there a way to tell Visual Studio to open a specific text file when the solution/project opens?

+1  A: 

What Will said.

The UI state of the solution (e.g. which files are open for editing) is stored in one of the solution files of which there's supposed to be a separate copy for each user, and which therefore isn't usually checked-in to the shared version control: i.e. not the *.sln file but instead I think the *.suo file (but beware, this is a binary file which won't 'merge').

ChrisW
+1  A: 

I don't think it is possible to have a solution file open specific content or even script actions, actually.

Perhaps you could create an MSI setup for your library (if you haven't already) and not deliver a solution with example code, but a project template that is installed by the MSI in the right place to be instantly available as a template in VisualStudio? Then someone can easily do "New Project", select the demonstration template and get a project preset with your example code.

peSHIr
Interesting idea but I don't see how it solves my problem
Dror Helper
A: 

Just make a .bat file (using the VS env) with that calls devenv /useenv yoursolution.sln - this way you can make things a bit fancy if you want to ;)

Henrik Hartz
The problem is that I don't want my users to have run other files just the sln
Dror Helper
+1  A: 

It sounds like a solution or project template would be the best option. This would let you create an entry in the user's File - New dialog (Similar to 'New Class Library" etc). In VS 2008, these are easier to create - File -> Export Template. The template is just a zip of the project(s) with an xml manifest file you can modify. Part of the manifest schema allows you to specify files to open as HTML or text. The templates can be installed relatively easily as part of a installer package.

Here's more on the general concept: http://msdn.microsoft.com/en-us/library/6db0hwky.aspx

And schema reference about how to open files in various modes on startup: http://msdn.microsoft.com/en-us/library/ys81cc94.aspx

If you need to provide more guidance/wizards, consider Guidance Automation Toolkit.

Daniel