{"id":6403,"date":"2007-03-26T15:00:00","date_gmt":"2007-03-26T15:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2007\/03\/26\/coding-a-euchre-game-part-9-into-the-wild-blue-yonder-matt-gertz\/"},"modified":"2024-07-05T14:48:56","modified_gmt":"2024-07-05T21:48:56","slug":"coding-a-euchre-game-part-9-into-the-wild-blue-yonder-matt-gertz","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/coding-a-euchre-game-part-9-into-the-wild-blue-yonder-matt-gertz\/","title":{"rendered":"Coding a Euchre Game, Part 9:  Into the Wild Blue Yonder (Matt Gertz)"},"content":{"rendered":"<h2><font size=\"5\"><font color=\"#365f91\"><font face=\"Cambria\">Coding a Euchre Game, <span>Part 9:<span>&nbsp; <\/span>Into the Wild Blue Yonder<\/span><\/font><\/font><\/font><\/h2>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">So, here we are at the end of this series, which I hope you\u2019ve found interesting.<span>&nbsp; <\/span>In this final post, I\u2019m going to talk about deployment \u2013 getting your code shipped to another person.<span>&nbsp; <\/span>Oh, and the final code (including the deployment project) is included at the bottom of this post.<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">It can be a lot of fun to code &amp; play your own card game, but at some point, you\u2019re going to want to share it with friends or sell it to customers.<span>&nbsp; <\/span>Visual Studio gives you two options for this:<span>&nbsp; <\/span>Click-Once deployment and Setup projects.<span>&nbsp; <\/span>I\u2019ve opted for setup projects for the Euchre game, since I don\u2019t have a web server for my friends and family to download the game from, but it\u2019s worth discussing Click Once as well.<\/font><\/font><\/span><\/p>\n<h2><span><font size=\"4\"><font color=\"#4f81bd\"><font face=\"Cambria\">Click Once<\/font><\/font><\/font><\/span><\/h2>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Click Once deployment is very simple to use \u2013 all you need is a location to which to deploy the application that others can get to as well.<span>&nbsp; <\/span>Click Once doesn\u2019t require creating a new project; you can run everything from the the application itself.<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">To start a basic Click Once operation, right-click on the project and choose \u201cPublish\u2026\u201d<span>&nbsp; <\/span>If you wanted to, you could then just click \u201cFinish\u201d in the resulting wizard and deploy the application to the default location (hence the name \u201cClick Once\u201d); however, you\u2019re likely to want to deploy it elsewhere.<span>&nbsp; <\/span>Type in the address of the site you wish to deploy to (http, ftp, file share, and disk path are all supported) and click \u201cNext.\u201d<span>&nbsp; <\/span>On the next page, decide whether or not you want the application to be usable all the time, or only when the user is connected to the internet.<span>&nbsp; <\/span>(The default is that the application is always usable.)<span>&nbsp; <\/span>Click \u201cNext\u201d and review the information, clicking \u201cFinish\u201d if everything is correct.<span>&nbsp; <\/span>The application will deploy (this can take a while, depending on where you\u2019re deploying it to, the connection speed, etc.), and then you\u2019ll be presented with a web page which has the download instructions on it.<span>&nbsp; <\/span>This is the page your friends\/family\/customers will navigate to in order to download the application; clicking the install button on this page will cause the app to download and install.<span>&nbsp; <\/span>Best of all, if you update your app and republish it, your users will automatically get the updates they next time they start up the application.<span>&nbsp; <\/span>(That\u2019s a default behavior that you can change.)<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">If you want a little more control over Click Once, you can bring up the project properties (right-click the project, choose \u201cProperties\u201d) and click on the \u201cPublish\u201d tab.<span>&nbsp; <\/span>Here you can specify the target publishing directory and offline behavior as before, but you can also specify an installtion URL (if you don\u2019t want to use the default page that gets created and a version number, and (more importantly) you can also specify prerequisites.<span>&nbsp;&nbsp; <\/span>Click the button labelled \u201cPrerequisites.\u201d<span>&nbsp; <\/span>Notice in the resulting dialog that .NET 2.0 is already selected, and that the default setting is for the user to download .NET 2.0 from the same place as your application (if they don\u2019t already have it installed) \u2013 you\u2019ve got a copy of the redistributable .NET package, and that gets deployed along with your application.<span>&nbsp; <\/span><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Of course, if you want speech to work, you also need to make sure that the speech redist package <span>&nbsp;<\/span>gets installed.<span>&nbsp; <\/span>You will note that it is *not* listed as one of the prerequisites.<span>&nbsp; <\/span>Click Once looks for prerequisites in C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\BootStrapper\\Packages \u2013 there are directories there which contain each of the redistributable packages.<span>&nbsp; <\/span>I\u2019m not going to go into this overmuch here, but to add a prerequisite to the list, you need to create an appropriately-named directory here, copy over the (expanded) Speech SDK redistribution files (which we downloaded in on of the previous posts), and add a product.xml file in the directory.<span>&nbsp; <\/span>The product.xml file is slightly arcane, so if you *really* want to do this, I suggest checking out the other product.XML files in there.<span>&nbsp; <\/span>I may cover this topic in more detail later (I\u2019ll be totally honest; I\u2019ve never added a prerequisite myself), but in the meantime I\u2019ll press on to another mechanism for deployment which will support deploying the Speech redist package without much fuss:<span>&nbsp; <\/span>setup projects.<\/font><\/font><\/span><\/p>\n<h2><span><font size=\"4\"><font color=\"#4f81bd\"><font face=\"Cambria\">Setup projects<\/font><\/font><\/font><\/span><\/h2>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Setup projects are a great way to create installers for your application, particularly if you\u2019re going to be distributing your application on CD.<span>&nbsp; <\/span>Setup projects use Windows Installer technology, and so will be installable by anyone running any recent version of Windows.<span>&nbsp; <\/span>Here\u2019s what you need to do:<\/font><\/font><\/span><\/p>\n<p class=\"MsoListParagraphCxSpFirst\"><span><span><font face=\"Calibri\" size=\"3\">(1)<\/font><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font size=\"3\"><font face=\"Calibri\"><b><span>Create a setup project<\/span><\/b><span>.<span>&nbsp; <\/span>Click the \u201cFile\u201d menu and choose \u201cAdd\u201d<\/span><\/font><span><span>\u00e0<\/span><\/span><span><font face=\"Calibri\"> \u201cNew Project.\u201d<span>&nbsp; <\/span>In the resulting dialog, expand the \u201cOther Project Types\u201d node, select the \u201cSetup and Deployment\u201d chil node, and choose \u201cSetup Project\u201d in the listview.<span>&nbsp; <\/span>Give it the name \u201cVBEuchre Installer.\u201d<\/font><\/span><\/font><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\"><span><span><font face=\"Calibri\" size=\"3\">(2)<\/font><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font size=\"3\"><font face=\"Calibri\"><b><span>Add the outputs of the Euchre game to the setup project<\/span><\/b><span>. Right-click on the installer project and choose \u201cAdd\u201d<\/span><\/font><span><span>\u00e0<\/span><\/span><span><font face=\"Calibri\"> \u201cProject Output.\u201d<span>&nbsp; <\/span>Make sure that the Euchre game project is selected in the top drop-down and that \u201cPrimary Output\u201d is selected in the list box.<span>&nbsp; <\/span>Press OK.<span>&nbsp; <\/span>The primary outputs of the Euchre game will be added to the setup project \u2013 every time the setup project builds, it will ask the Euchre project for its primary outputs (that is, the VBEUCHRE.EXE file that it builds).<span>&nbsp; <\/span>This is better than adding the EXE file directly to the setup project, because using the \u201cproject output\u201d option will also force the Euchre app to make sure that it is fully built.<\/font><\/span><\/font><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\"><span><span><font face=\"Calibri\" size=\"3\">(3)<\/font><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font size=\"3\"><font face=\"Calibri\"><b><span>Add the speech redist<\/span><\/b><span>.<span>&nbsp; <\/span>The setup project will already have detected that the Euchre game requires the speech DLLs, but we want to make sure that the proper installation is followed.<span>&nbsp; <\/span>We\u2019ll use merge modules for this \u2013 they are binaries which contain installation information for a feature or set of features.<span>&nbsp; <\/span>Too add them, right-click the installer project and choose \u201cAdd\u201d<\/span><\/font><span><span>\u00e0<\/span><\/span><span><font face=\"Calibri\"> \u201cMerge Module.\u201d<span>&nbsp; <\/span>In the file dialog that follows, navigate to the speech directory and select the following MSM files there: Sp5, Sp5intl, Sp5TTInt, Sp5TTIntXP, SpCommon.<span>&nbsp; <\/span>By adding these merge modules, your installer will set up the Speech redist on the target machine, including all of the spiffy voices.<span>&nbsp; <\/span>Note that the .NET dependency will be handled automatically.<\/font><\/span><\/font><\/p>\n<p class=\"MsoListParagraphCxSpLast\"><span><span><font face=\"Calibri\" size=\"3\">(4)<\/font><span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font size=\"3\"><font face=\"Calibri\"><b><span>Add any \u201cdecorations\u201d you want<\/span><\/b><span>.<span>&nbsp; <\/span>Want to add a shortcut on the user\u2019s desktop during the install?<span>&nbsp; <\/span>No problem!<span>&nbsp; <\/span>Right-click the installer project and choose \u201cView\u201d<\/span><\/font><span><span>\u00e0<\/span><\/span><span><font face=\"Calibri\">\u201dFile System.\u201d This will bring up a file system editor which gives allows you to specify where things will go on<span>&nbsp; <\/span>the target machine.<span>&nbsp; <\/span>Select \u201cApplication Folder\u201d (on the user\u2019s machine, this will typically translate to \u201cC:\\Program files\\VBEuchre\u201d)and in the right-hand pane, right-click on the \u201cPrimary Output of VBEuchre (Active)\u201d and choose \u201cCreate Shortcut to Primary Output of VBEuchre (Active).\u201d<span>&nbsp; <\/span>Drag the resulting shortcut to \u201cUser\u2019s Desktop.\u201d<span>&nbsp; <\/span>Repeat this to create another shortcut, but drag it to \u201cUser\u2019s Programs Menu\u201d this time.<span>&nbsp; <\/span>That\u2019s pretty much it \u2013 when installed, there will be a shortcut on the user\u2019s desktop and in their programs menu.<\/font><\/span><\/font><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">That\u2019s all you have to do (although there are certainly other things that you can do using setup projects as well).<span>&nbsp; <\/span>Build the setup project, and you\u2019ll find the results in the Release directory for the installer project.<span>&nbsp; <\/span>Burn \u2018em to CD, and hand it out to your friends, family, or customers.<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">The entire solution is appended to this post.&nbsp; <strong><u>Important note:<\/u><\/strong>&nbsp; The setup project expects the Speech MSMs to be in its directory, but I have not included them in this zip file &#8212; they are too big to attach (11 MB total)!&nbsp; <strong>If you want to try out the setup project, you will need to download the Speech SDK (as mentioned in a previous post) and drag the&nbsp;5 relevant MSMs into the installer&#8217;s project directory before the setup project will load correctly.&nbsp; <\/strong>(The actual Euchre project should open fine regardless.)&nbsp; I&#8217;ve also included all 44 pages of this blog series in a word document in the ZIP file in case you want to easily refer back to it.<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Let me know if you have any problems with the game!<span>&nbsp; <\/span>That was a lot of typing for me, so I\u2019m going to give my wrists a rest for about a week, and then I\u2019ll return with an article on how I used VB to defeat malware.<span>&nbsp; <\/span>Talk to you then!<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\" size=\"3\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">&#8211;Matt&#8211;*<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Calibri\" size=\"3\"><\/font><\/span>&nbsp;<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/01\/95\/40\/54\/VBEuchre.zip\">VBEuchre.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coding a Euchre Game, Part 9:&nbsp; Into the Wild Blue Yonder So, here we are at the end of this series, which I hope you\u2019ve found interesting.&nbsp; In this final post, I\u2019m going to talk about deployment \u2013 getting your code shipped to another person.&nbsp; Oh, and the final code (including the deployment project) is [&hellip;]<\/p>\n","protected":false},"author":258,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[22,195],"tags":[101,165],"class_list":["post-6403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-matt-gertz","category-visual-basic","tag-matt-gertz","tag-vb2005"],"acf":[],"blog_post_summary":"<p>Coding a Euchre Game, Part 9:&nbsp; Into the Wild Blue Yonder So, here we are at the end of this series, which I hope you\u2019ve found interesting.&nbsp; In this final post, I\u2019m going to talk about deployment \u2013 getting your code shipped to another person.&nbsp; Oh, and the final code (including the deployment project) is [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/6403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/258"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=6403"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/6403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=6403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=6403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=6403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}