November 2004 - Posts

Wer .NET TV und dotnetpro.tv (bei der dotnetpro) mag und auf der Suche nach weiteren kurzweiligen Informationsquellen ist, der sollte sich einmal die "Head First"-Buchreihe von O'Reilly anschauen. Da gibt es zwar vor allem Java-Bücher, aber auch ein empfehlenswertes zu Design Patterns für die Freunde von .NET:

Schnellentschlossene und Überzeugte können den Titel auch in Deutschland gleich bei Amazon.de bestellen und sparen sich Versandkosten. Ich hab das jedenfalls gemacht :-)

Und ich fühle mich durch die "Head First"-Reihe in meinem Ansatz bei .NET TV bestärkt: Information muss nicht immer staubtrocken in üblicher Lehrbuch- oder Vortragsform vermittelt werden. Lernen und Kurzweil gehen sehr wohl zusammen.

[Vielen Dank an meinen .NET Twins-Bruder Christian Weyer für den Hinweis auf die Buchreihe.]

Am Wochenende bin ich in der Lehmanns Fachbuchhandlung in Hamburg über ein Regal mit vielen interessanten APress-Titel zu sehr günstigen Preisen gestolpert. Statt 49 EUR so um die 12-14 EUR kosten sie. Eine Liste der Titel findet sich hier:

http://www.lob.de/cgi-bin/work/fs_pages?flag=new&page=apress

Das Stöbern lohnt sich, denn man kann die Bücher auch online bestellen.
Für unter 15 EUR kann man dabei kaum etwas falsch machen :-)

I. Enable Intellisense Support

1. Create XML Schema

Create a XML Schema for the XML files you want to edit within VS.NET. (If you´re not familiar with XML Schema, start out with an example XML file and use xsd.exe (one of the VS.NET tools) to generate a XML Schema.)

Let´s assume your XML Schema is called myschema.xsd. It should start out like this:

<xs:schema id="MyXMLFiletype" 
                  targetNamespace="http://schemas.mydomain.com/MySchema"
                  xmlns="http://schemas.mydomain.com/MySchema"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema">
...

Be sure to include an id and a targetNamespace! The targetNamespace will be shown later in VS.NET in a list to select from.


2. Register File Type

Come up with a file type for your XML files, e.g. .xyz. What you now want is, that VS.NET knows, .xyz files are XML files and supports you with the XML editor when working on such files.

Create a registry .reg file to make the .xyz file type know to VS.NET and be associated with the XML editor. Copy the following to a text file you save as xyz.reg. Replace all xyz occurrences with your file extension:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Editors\{8281C572-2171-45AA-A642-7D8BC1662F1C}\Extensions]
"xyz"=dword:00000027

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Editors\{C76D83F8-A489-11D0-8195-00A0C91BBEE3}\Extensions]
"xyz"=dword:00000028

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Languages\File Extensions\.xyz]
@="{58E975A0-F8FE-11D2-A6AE-00104BCC7269}"
"unused"="HTML"

After you executed the xyz.reg file, whenever you open a .xyz file in VS.NET it´s displayed with colored elements and attributes.


3. Register XML Schema with VS.NET

Copy the XML Schema to the following directory:

C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml

From then on, when you open an .xyz file, create the appropriate root element and type the attribute name xmlns= on it, a list of schemas pops up and you can select http://schemas.mydomain.com/MySchema to be associated with the file.

As soon as this schema is referenced in your .xyz file, you have intellisens and VS.NET will point out any validation errors.


II. Add New File Type

If you want to be able to create a new file of type .xyz from within VS.NET, you need to register a new file item.

1. Create File Item Template

Create a template file for new .xyz files, e.g. by creating a file which just contains the root element and the xmlns= attribute with the namespace. Call the file myxyz.xyz.


2. Register File Item Template

First copy myxyz.xyz to C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\NewFileItems.

Then make it know to VS.NET by adding a line to the file NewFileItems.vsdir like the following:

myxyz.xyz|{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}|XYZ File|110|Create cool XYZ files with a snap|0|#6815|0|myxyz.xyz

From then on you´ll see a new item for you .xyz files in the list of menu item File|New|File of VS.NET.

Files you create this way, though, don´t belong to a project. If you want to easily include .xyz file into your VB.NET or C# projects, you need to register a new item type with VS.NET.


III. Add New Item Type

If you want to add .xyz files to your projects, you need to set up a new item type. Following are the steps to register a new item type for VB.NET projects. For C# projects it´s equally easy; just replace references to the VB-language with ones for C# in directory names etc.

1. Create Item Wizard Launch File

Create a VS.NET wizard launch file xyz.vsz like this:

VSWIZARD 7.0
Wizard=VsWizard.VsWizardEngine.7.1
Param="WIZARD_NAME = XYZFile"
Param="WIZARD_UI = FALSE"
Param="PROJECT_TYPE = VBPROJ"

Place xyz.vsz in C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBProjectItems.


2. Register Wizard Launch File

In C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBProjectItems\Local Project Items open LocalProjectItems.vsdir and add a line like this to register the above wizard launch file:

..\xyz.vsz|{164B10B9-B200-11D0-8C61-00A0C91E29D5}|XYZ File|75|Create cool XYZ files in your projects|{164B10B9-B200-11D0-8C61-00A0C91E29D5}|4539| |myxyz.xyz


3. Create Item Wizard

3.1 Copy the directory C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\XMLFile to

C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\XYZFile

where XYZFile is the value of WIZARD_NAME in the above launch file.

3.2 Copy into

C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\XYZFile\Templates\1033

the template file you already used up in step II.1.

3.3. Open default.js in C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\SqlObjectsFile\Scripts\1033.

Replace XMLFile.Xml therein with the name of your template file, myxyz.xyz.

Vor mehr als einem Jahr habe ich dotnet.tv (bzw. .NET TV) begonnen zu produzieren. Inzwischen sind 8 Folgen erschienen und viele begeisterte Zuschauerstimmen haben gezeigt, dass Video ein geeignetes Medium zur Wissensvermittlung ist und darüber hinaus einfach aus Spaß machen kann.

Leider hat es sich nun ergeben, dass .NET TV im Augenblick mangels ausreichender Sponsorengelder ruhen muss. Das ist schade...

Als "Trostpflaster" bietet die dotnetpro jedoch ab sofort

 

dotnetpro.tv erklärt mit jeder Folge wieder ein technisches Thema - diesmal jedoch in Form eines Interviews mit einem Experten aus der Entwicklergemeinde.

In der ersten Folge geht es um Zero Touch Deployment

und der Experte ist Neno Loje, bekannt als Autor der dotnetpro und Sprecher auf Entwicklerveranstaltungen:

Für den Dreh hatten wir uns auf einen Nachmittag im Büro von Keep IT Simple in Hamburg getroffen, wo Neno neben seinem Studium arbeitet.

Neno war gut vorbereitet, aber trotzdem hat es statt der geplanten 2 Stunden ca. 5,5 Stunden gedauert. Uns beiden lag es einfach nicht, nur nebeneinander am Tisch zu sitzen und ein Interview zu machen. Viel zu statisch, fanden wir. Also haben wir zwar das Thema sequenziell abgedreht, aber mit häufigen Einstellungswechseln, um das Bild lebendiger zu halten.

Aber nicht nur die Art der Themendarstellung ist neu! dotnetpro.tv hat von der ersten folge an ein Logo (s.o.) und auch noch eine kleine Titelmusik (MP3-Version)! Wir haben also keine Mühen und Kosten gescheut, um ein würdiges "Trostpflaster" für die Freunde von .NET TV zu produzieren.

Wie dotnet.tv ist aber auch dotnetpro.tv nicht ohne die Unterstützung eines Sponsors möglich. Die dotnetpro wird bei diesem Projekt unterstützt von...

Wir sind alle gespannt, wie die dotnetpro.tv nun in der Entwicklergemeinde ankommt. Wie immer freue ich mich über Feedback!

More Posts