How do I add context help to an assembly - c#

I have created a .NET C# component that I am going to sell as a developers tool. My question is, how do I add my own custom context help to the methods and properties.
So, when I press F1 over a method I want it to go to a specific web page. Is this even possible?

Use the Visual Studio SDK and the help integration kit
Part of the Visual Studio SDK is the Help Integration project type. Information about integrating with help here (MSDN). Same applies for VS 2005 and 2008.
Here's a link to the download, for earlier versions of VS (before '05).
There's an entire development center about the Visual Studio SDK.
The effort feels a lot higher than shipping a .Chm and/or IntelliSense files, but I understand you'd like to add examples, etc.
Consider if it's worth the effort
Are you providing enough information in the IntelliSense documentation files (.xml) for all of your component's assemblies?
More often than not, that's sufficient to provide a lot of information, including additional remarks, notes, etc.
I may just be biased to my development workflow and that of my co-workers, but I can't remember the last time that I saw anyone press "F1" in Visual Studio.
Plus, if you really ever do want a full-blown .Chm help file, your XML documentation comments can be turned into that with little effort thanks to tools like Sandcastle and formerly NDoc.

Aside from the traditional F1 help, I find that Sandcastle created CHM files are extremely helpful when deploying any reusable libraries and frameworks. GhostDoc has proven quite useful for creating the in-code XML needed for Sandcastle CHM files. Sandcastle also has the option of creating MSDN-style HTML help files as well as the tried-and-true CHM.

Context help is generated via the XML documentation in your code.
If you're unfamiliar with it, in C#.NET you can document a function by typing three successive forward-slashes before the method signature:
/// <summary>
/// What Foo() does...
/// </summary>
/// <param name="bar">What bar is...</param>
/// <returns>What the return int is...</returns>
public int Foo(string bar)
{
// Does something...
}
In VB.NET, I believe it's three apostrophes.

Assuming you're familiar with using xml comments to create the xml intellisense file and can use sandcastle to generate .chm files separately then the missing piece is F1 integration.
This article is ancient but indicates how to do it with VS 6.0 era help
The comments there direct you to the 2003 integration kit
Beyond that you seem to have to download the actual VS SDK.
This page seems pretty up to date (it has info on changes in 2010)

Related

Visual Studio intellisense and debug only in certain areas

I wrote a simple web-server that interprets c# inside HTML in real time (Like Razor, but it looks more like PHP style tags, just written in C#). Every C# code snippet is wrapped with <# and #>.
Now, I want to start writing a simple web application using it. Working with Notepad++ is painfully annoying, due to the fact it cannot really autocomplete C# well, and C# is a strict language (unlike PHP, Javascript or Python, in which developing in Atom or NP++ is extremely easy and natural).
So, the question:
I wanted to know if there is any way that I can edit those pages in Visual Studio, have all the autocomplete functionality, and in the same time let VS know that I want it to notice (colorize, syntax-check, etc) only code snippets wrapped in <# and #>.
How do I do that?
Visual studio 2015
Can be web developer or desktop version, I can any of them.
Thanks!
Visual Studio has a very powerful extension SDK, so you can achieve what you want by developing one or more extensions. If you're new to extension development, I'd suggest you take a look at this getting started guide first.
Microsoft has quite a few samples available on GitHub. At least the following two samples should be of interest to you.
Syntax coloring: Diff Classifier Sample
Custom programming language support: Ook Language Integration Sample
The Ook sample goes a bit further than what you actually need, but it has some elements that are usable to you.

c#-doc-viewer for VisualStudio

c# offers a nice way to document your c#-code. But I don´t find any nice viewer. I search something like the java-doc-viewer in eclipse. This viewer allows you to browse in the java-doc just by moving your mouse over eg. a class-name.
Does someone know a good extension for Visual Studio 2010 that contains such a viewer?
I have the "Productivity Power Tools"-Extension installed. But it hasn´t a real doc-viewer either.
Edit:
Here is a picture of what I search:
And this is the best I can find for VisualStudio:
You try using CR_Documentor, if you don't mind installing Code Rush (alone for that purpose; you only need the free "DXCore" actually, checkout the project's homepage for more information).
Note that this tool doesn't require a prior generation of the documentation using tools like Sandcastle. It works by simply placing your cursor in a API comment block, e.g. that of a method.
Obviously, this has some drawbacks, for example, links to other items (e.g. <see/> or <seealso> will be rendered as a link, but don't work as such).
This is what it looks like:
I was using it once, way back when it was still maintained by the original author Lutz Roeder, and it did it's job well. I have not been using it since.
Update: You could also use ReSharper, which provides a "Quick Documentation" feature.
There isn't any built-in tool in VS for viewing the documentation of your code. You have to generate the documentation pages from the XML doc, using external tools.
Free tools:
Sandcastle is the most well known, it has a lot of features, but it doesn't seem to be maintained any more and it's quite difficult to use (although Sandcastle Help File Builder makes it significantly easier, and is still maintained).
docu is simpler to use, but not specific to .NET
Monodoc (from the Mono project)
Commercial tools:
VSdocman
Document! X
Doc-O-Matic
ForgeDoc: this one is quite new and looks very promising: very lightweight, simple to use, fast, good-looking output... It's also much cheaper than the others above
You can use NDoc to build the API documentation and generate help files (typically HTML files)
http://sourceforge.net/projects/ndoc/

Visual Studio 2008 and C#

I'm an IT Professional with a background with developing ASP/VBscript/SQL web applications. I want to take some training and get up to speed with Visual Studio 2008 and C# so that I can take over a project at work and make updates/bug fixes in house rather than calling in a third party.
The web application I'll be working on was developed in Visual Studio 2005 with a mix of C# code and some Ajax.
When I load the source code into Visual Studio 2008 I received a warning that the Source Control Plugin wasn't installed. It's looking for SourceSafe which I don't have. Is this necessary to use?
I'm starting a training course in February called Introduction to Visual Studio C# 2008. Well this be adequate to get me going in the right direction to be able to update, fix, and make minor changes to our web application? This is a big opportunity for me and I don't want to blow it.
Thanks!
SourceSafe is a Software Configuration Management tool from Microsoft, and is not required. I WOULD recommend using some form of SCM, but flavor is a matter of preference.
If the pop-ups are annoying to you and you would like to disable them, then removing the SourceSafe bindings from the project should stop them.
From http://weblogs.asp.net/bkcarroll/archive/2004/03/08/86059.aspx :
Solution:
1 - Go to the folder containing the solution files and delete the following:
mssccprj.scc
MyProject.vssscc
vssver.scc
2 - Open MyProject.sln in your favorite text editor and remove the following section:
GlobalSection(SourceCodeControl) = preSolution
...
EndGlobalSection
3 - Go to the folder containing the project files and delete the following:
MyProject.vbproj.vspscc
mssccprj.scc
vssver.scc
4 - Open MyProject.vbproj in your text editor and remove the following lines:
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
Now you can open the solution/project with no source control errors.
As far as the class goes, if you're already familiar with ASP/VBScript, you can probably pick up a C# class and figure out the rest. If not, I would suggest going for an ASP focused class that utilizes a C# back-end.
I would expect that a course named "Introduction to Visual Studio C# 2008" would probably not cover Ajax technologies, so you might want to look for some additional resources on that topic. (It might not even cover ASP.NET in significant depth, so I'd advise checking the syllabus, and if the ASP.NET coverage is weak then prepare for some additional learning on that topic as well.)
Re the Source Safe plug-in: you will need this if you want to work on the code base (so you can check in and out of the existing VSS repository). You will not need it just to browse the code.
Well James that is up to you. I am not familer with the course but if you apply yourself and pay attention I'm sure you can achive your goal. Do not be afraid to move beyond just course work to learn new things. There is a lot of information about Visual Studio on the internet.
SourceSafe is not required to use Visual Studio.
Learning the basics of VS will definitely allow you to update and fix your web apps. VS allows you to work with all the technologies you mentioned all in one environment. Although ASP/VBScript are "legacy" at this point, there is still support for them in the VS environment.
James I'd suggest that you look at the free resources (video and textual) available to you on ASP.NET. I would presume that once you've read a few tutorials and watched some videos + taken your training course you should be able to maintain the code base. Add in the fact that sites like StackOverflow have a large .NET community and there are always people willing to help.
Good luck

Windows.Form c# without visual studio

I am trying to learn Windows.Forms, and while I have Visual Studio (edit, my mistake obviously), I feel that I learn much more effectively by doing everything in Notepad. I have searched everywhere for a tutorial that takes this approach. I finally got started with http://www.geekpedia.com/tutorial33_Windows-forms-programming.html, but after the first example, it too begins working with multiple files? somehow generated with Visual Studio. How can I do this in Notepad? Can anyone point me somewhere helpful?
Thanks!
**While the overwhelming response seems seems strongly against this and I started to be convinced, I saw SmokingRope talking about it being as simple as writing all classes into one file. This is what I have been doing up till now for sizable, just non Windows.Form projects into. Can you maybe help explain how those necessary files can be included using this method?*
Seriously... I admire your fire, but you are out of your mind! What you can possibly hope to learn about .NET with NotePad that you couldn't learn a zillion times faster with Visual Studio? It's like asking, "I want to learn to drive a car. I have put wheels on my couch. What should I do next?"
I mean no disrespect, but make friends with Visual Studio and get busy learning. You're wasting your time otherwise.
It is actually quite easy to code C# outside of the IDE. It will basically come down to using the csc.exe compiler from the command line prompt.
The hardest part of this process is making sure the environment variables are correctly configure and Microsoft provides the vsvars32.bat batch file to do exactly that.
Here is a short tutorial on how to do use this batch file and the compiler from the command line: http://www.zeusedit.com/forum/viewtopic.php?t=1235
And an even better, but slightly more complicate approach is to use MsBuild utility to manage the building of the project: http://www.zeusedit.com/forum/viewtopic.php?t=2518
Finally you can even use the external C# Debugger to debug you programs: http://www.zeusedit.com/forum/viewtopic.php?t=2507
Your best approach is really to learn how to write code from within Visual Studio. You gain a lot of coding assistance (IntelliSense, syntax checking, etc.) that will help you learn the language.
If you really want to use Notepad, then you create as few or as many files as you want and then compile them in to an assembly using the command line compiler by listing each file as an input to the compiler.
The reality of this is that using notepad and the command line compiler is possible but very cumbersome and almost never used outside of showing simple "Hello, world" type examples.
I am going against the grain here... But I think that your idea is not such a bad one... especially for a small project.
But using Notepad (or at LEAST use Notepad++) will teach you more about MSBuild and the VBC or CSC compiler syntax than it will teach you about the language features. The best way to learn the language, is, as other have said, using Visual Studio. The intellisense is a great way to learn.
But it also makes us lazy and it is true that we don't have to memorize as much...and sometimes having things memorized comes in handy. (ie.... I am at a customer and logged in remotely to the servers... no visual studio is installed... BUT... yippee... .NET 2 is there... at that moment you will have appreciated the exercise...)
Honestly, to do this for a reasonably small project I think would be a good exercise in learning. I say go for it. Hell, I might even join you.
But, that said, I think the very best way to do it would be to use both methods side-by-side. For example... If you want to use multiple files the way to do that is to create a folder and put an vbproj (or csproj) file in it. MSBuild.exe receives vbproj files (and sln files for that matter) as arguments. So, one of the quickest ways to learn the vbproj file syntax is to use visual studio to create a project... and then open the vbproj file in Notepad++.
The problem is that Visual Studio IS SO AWESOME BECAUSE it abstracts so much away from the developer. But it is silly to not acknowledge there is a downside to that. That abstraction means that we don't need to have as deep an understanding. Things just work automagically. So I say dig a little deeper. I don't think you will regret it.
Assuming that the thing you want to avoid is magically-generated-code and visual designers, you can just open the System.Windows.Forms namespace and start coding against the APIs. Start with that first example, and then programmatically add buttons and textboxes and whatnot. You don't have to create a forms project or work with the designers, you can just 'write code' in VS and turn off all the magic.
If you're looking for example code, you might consider looking at F# samples, e.g. the UI stuff at
http://code.msdn.microsoft.com/fsharpsamples
for ideas of a few basic controls you can add to forms to do basic UI stuff.
You can write multiple classes in a single C# file (despite the generally accepted best-practice of putting one class per file):
using System;
namespace Test{
class Class1{ }
class Class2{ }
}
You also could look into how the MSBuild system works from the commandline. I believe you will still have to maintain a project file (xml type syntax, use visual studio to create a project and then open that in notepad for an example) but i don't have any experience with it personally.
It's possible to do it all from notepad and the command prompt. You will probably find it to be a little more time consuming however.
If you want to learn c# and winforms, part of the skill set you need is being proficient in Visual Studio.
You can do things in Notepad for awhile (I wrote some web services in notepad once because I didn't have VS available), but eventually you will want to take advantage of the tools available in VS.
I highly recommend you use Visual Studio (Microsoft offers free Express versions that will meet your needs). Learning the syntax of the language is wonderful, but you must be able to work within the VS environment to be truly successful in C# (and any of the .NET languages). It benefits you more to do it right and learn it all together rather than try and piece it together later. Just my own two cents.
Just to repeat what's already said, again with no disrespect, you are not going to learn .NET in notepad. It's just not probable. Not only are you not be productive, but you're also not going to learn the tools used in the industry, best practices, and other important factors about .NET. It's not just about sitting down and writing code. By limiting yourself to notepad, it's like limiting yourself to one meal a month: you lack the nutrition needed to keep moving forward at a good pace.
Utilize the tools and resources available to you. Limiting yourself like that is a kick in the rear end.
Use sharpdevelop (Windows) or monodevelop (*nix). Both have Windows.Form support. Although they dont offer as much as VS, they'll at least get you started. I've never used the VS Express edition, so I don't know what it's limitations are.
Note that notepad is not even the equal of vi not to speak of vim.
If you want to use a text editor then you could try it but I don't see the point of using notepad. Use a real text editor, not necessarily vim/emacs, you could pick a nice gui text editor like notepad++ or kate.
Notepad can't even display unix line endings(I think).
Go download an Express edition of Visual Studio. I understand the possibility of thoroughly learning this via notepad, but with a free IDE out there, it makes no sense.
if u have something against MS or VS.net u can try sharpdevelop
http://www.icsharpcode.net/OpenSource/SD/
last time i looked it was xcopy deployable :)
I don't know where to find tutorials, but the approach is pretty straightforward: import System.Windows.Forms, derive a class from Form, and give it a .Show(). Your components are members of the class, and can be positioned using their respective position/size properties. Events are handled through delegates.
I do see where this technique is useful, though I'd use a decent IDE instead of Notepad. .NET is just too prolific. Knowing how to construct forms on the fly can come in handy.
If you're looking for an alternate IDE, check out icSharpCode's SharpDevelop.
Also, look into JScript.NET tutorials - there is no forms editor for that language, as inheritance simply isn't possible. But it's still based on .NET, so the basic motions are the same. Here's a decent one:
http://www.webreference.com/js/column117/
I know this is answered by strangely I haven't seen anyone talk about NAnt.
For years I developed in TextPad, with some syntax highlighting, + NAnt to do my builds. These days it'd be even easier as you can have your buildserver prep a proper msbuild for you (CC.NET + NAnt).
I also learned about a few things that physically couldn't do in Visual Studio (at the time it was .net 1.1). Definitely a good experience, and I'd recommend it really. Probably not for winforms though, because the designer is actually useful for that.
i am a notepad user. :) i don't have visual studio installed on my computer.
this is what im doing.
1st u must register your .net framework folder on Environmen Variables.. Path
or run on CMD this lines
path=%path%;(this is where ur .net framework address were)
(ex path=%path%;C:\Windows\Microsoft.NET\Framework\v4.0.30319)
then hit enter
2nd to compile a single notepad(save as .cs), locate the destination of the file using cmd. then. type "csc nameOfCS.cs"
for multi file.. "csc ManinCsForname.cs classes.cs classes.cs"
it will compile as exe.
for more command.
"csc /?"
its ok to use Visual Studio. but if you want to become more familiar with C# and structure. or can make a system on any PC. without using any IDE. u can do this.
Not using Notepad will help. Crimson Editor or TextPad or others have line numbering, syntax highlighting and many features you'd need. I'm sure Notepad has file size limitations which you might run into.
The sans-IDE element I can only fully answer from a Java point of view. I've done a fair amount of Java UI development using Crimson Editor, the Java SDK, batch files and/or either ANT or Maven at times. If you developing UI code that's generic or does a fair amount in dynamically then its ok. If your work involves designing many different specific Forms (i.e. screens that have many customer forms and aren't subject too much reuse) then the Designer features of the IDE are extremely useful.
However, I have found .NET IDE development a little frustrating coming from the above model of Java development.

Built-in localization tools in VS2008

I am working on a WinForms application programmed in C# .NET 2.0 and VS2008. I am just about to start translating the app into several languages. Before I start, is it a good idea to use the VS2008 itself for all the localization? Or is it better to use some external tool right away? This is my first .NET app, so I rather ask before I start. What are others using?
All strings used in my app are in resources, so I think the app is ready to be translated.
Thank you,
Petr
Who will be localizing it? Most external localization companies have utilities for this. If its yourself or your team the simplest thing is probably to use Visual Studio or something like what's mentioned here to convert it to and from a word doc:
http://blog.vermorel.com/?p=73
I finished the work on a site (REFULOG) and I generated the .resx files for every page (Tools/Generate Local Resource; Make sure you are in design or split mode, otherwise the menu item does not appear).
After this I tested the app called Resx Crunch (It is about to come out.) I loaded all the generated .resx files, added the desired languages, made the application copy the values from the default .resx files, so at the end it looked like this:
Default value | DE | ES
-------------------------------
apple |apple | apple
...
I saved the info as a CSV file and I sent it to the translator. When it came back from the translator:
Default value | DE | ES
-------------------------------
apple |Appfel | Manzana
...
I loaded it, Saved As into the application folder, and that was it.
I tried to use other localization tools, but they wante3d to do too much and could not do enough.
So to answer your question: Generate the meta tags & .resx files using Visual Studio and do the translation using some localization tool.
For the benefit of others who may come across this (2+ years after the last post), I'm the author of a professional localization product that makes the entire translation process extremely easy. It's a Visual Studio add-in that will extract all ".resx" strings from any arbitrary solution and load them into a single file that can be translated using a free standalone application (translators can download this from my site). The same add-in will then import the translated strings back into your solution. Extremely easy to use with many built-in safeguards, lots of bells and whistles, and online help (you won't need it much). See http://www.hexadigm.com

Categories