{"id":1131,"date":"2006-09-22T18:10:00","date_gmt":"2006-09-22T23:10:00","guid":{"rendered":"http:\/\/blogs.devhorizon.com\/reza\/?p=1131"},"modified":"2006-09-22T18:10:00","modified_gmt":"2006-09-22T23:10:00","slug":"vsnet-intellisense-for-build-files-in-nant","status":"publish","type":"post","link":"https:\/\/blogs.devhorizon.com\/reza\/2006\/09\/22\/vsnet-intellisense-for-build-files-in-nant\/","title":{"rendered":"VS.NET Intellisense for .build files in NAnt"},"content":{"rendered":"<p><P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\">If you have ever worked with <A href=\"http:\/\/nant.sourceforge.net\/\">NAnt<\/A>&nbsp;, you probably know that there is an xsd for .build files that provides intellisense in VS.NET 2003. After you add a task dll ( In my case NAnt.SharePoint.Task.dll) or<SPAN style=\"mso-spacerun: yes\">&nbsp;<\/SPAN>install a newer version of NAnt , there are some manual steps required to make VS recognizes the new schema. Instead of the manual process, you can get NAnt itself to update\/generate its schema for the internal use of VS.NET 2003 by creating a build file and calling the command line as described below:<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\">1) Create UpdateCreateSchema.build file with the following NAnt snippet and save the file in for example c:<br \/>\nantGen folder :<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\"><?xml version=\"1.0\" encoding=\"utf-8\" ?><?xml:namespace prefix = o ns = \"urn:schemas-microsoft-com:office:office\" \/><o:p><\/o:p><\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\"><PROJECT default=\"genschema\" name=\" UpdateCreateSchema\"><o:p><\/o:p><\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\"><SPAN style=\"mso-spacerun: yes\">&nbsp;<\/SPAN><SPAN style=\"mso-spacerun: yes\"><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\"><?<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: maroon; mso-ansi-language: EN\">xml<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">version<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;1.0&#8243;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">encoding<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;utf-8&#8243;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">?&gt;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; mso-ansi-language: EN\"> <BR><SPAN style=\"COLOR: blue\">&lt;<\/SPAN><SPAN style=\"COLOR: maroon\">project<\/SPAN><SPAN style=\"COLOR: fuchsia\"> <\/SPAN><SPAN style=\"COLOR: red\">name<\/SPAN><SPAN style=\"COLOR: blue\">=&#8221;<\/SPAN><\/SPAN><SPAN lang=EN> <\/SPAN>UpdateCreateSchema<SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">&#8220;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">default<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;genschema&#8221;&gt;<BR><SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp;&nbsp; <\/SPAN><!\u2014VS.NET destination <SPAN style=\"mso-spacerun: yes\">&nbsp;<\/SPAN>might be different in your installation&#8211;&gt;<\/SPAN><\/SPAN><\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\"><SPAN style=\"mso-spacerun: yes\"><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">&nbsp;&nbsp;&nbsp; &lt;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: maroon; mso-ansi-language: EN\">property<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">name<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;SchemaFile&#8221;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">value<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;C:Program FilesMicrosoft Visual Studio .NET 2003Common7PackagesschemasxmlNAnt.xsd&#8221;\/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: maroon; mso-ansi-language: EN\">target<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">name<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;genschema&#8221;&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: maroon; mso-ansi-language: EN\">nantschema<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">output<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;${SchemaFile}&#8221;<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: fuchsia; mso-ansi-language: EN\"> <\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: red; mso-ansi-language: EN\">target-ns<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">=&#8221;http:\/\/nant.sf.net\/schemas\/nant.xsd&#8221;\/&gt;<BR>&nbsp;&nbsp;&nbsp; <\/< SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: maroon; mso-ansi-language: EN\">target<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">&gt;<BR><\/< SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: maroon; mso-ansi-language: EN\">project<\/SPAN><SPAN lang=EN style=\"FONT-SIZE: 10pt; COLOR: blue; mso-ansi-language: EN\">&gt;<\/SPAN><\/SPAN><SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp;&nbsp; <\/SPAN><\/P><\/BLOCKQUOTE><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\">2) Assuming Nant has been properly added to Path variable, open a command prompt and change directory to c:<br \/>\nantGen . Call the following command line:<o:p><\/o:p><\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\"><SPAN style=\"mso-spacerun: yes\"><\/SPAN><\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in\"><SPAN style=\"mso-spacerun: yes\">&nbsp;<\/SPAN>nant file: UpdateCreateSchema.build<\/P><\/BLOCKQUOTE><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\">3) Now that you have deployed the latest version of NAnt.xsd file to the C:Program FilesMicrosoft Visual Studio .NET 2003Common7Packagesschemasxml folder , you must go through all of your build files in your project and <\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt 0.5in\">a.Make VS.NET recognize your .build file as an XML file (If already done, skip this step then ):<o:p>&nbsp;<\/o:p><\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt 0.5in\">In &#8220;Solution Explorer&#8221;, right-click a .build file and choose &#8220;Open With&#8221;. In the &#8220;Open With&#8221; dialog, select &#8220;HTML\/XML Editor&#8221; and click the &#8220;Set as Default&#8221; button. Enable intellisense for each .build file.<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt 0.5in\">b.When file is opened by the &#8220;HTML\/XML Editor&#8221; , in the properties window , set the targetSchema to the newly updated\/generated Nant.xsd<\/P><\/BLOCKQUOTE><br \/>\n<P class=MsoNormal style=\"MARGIN: 0in 0in 0pt\">4) Boom. You&#8217;ll get intellisense. Enjoy!<\/P><\/SPAN><\/SPAN><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have ever worked with NAnt&nbsp;, you probably know that there is an xsd for .build files that provides intellisense in VS.NET 2003. After you add a task dll ( In my case NAnt.SharePoint.Task.dll) or&nbsp;install a newer version of NAnt , there are some manual steps required to make VS recognizes the new schema. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1131","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts\/1131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/comments?post=1131"}],"version-history":[{"count":0,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts\/1131\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/media?parent=1131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/categories?post=1131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/tags?post=1131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}