{"id":68,"date":"2010-08-09T13:51:00","date_gmt":"2010-08-09T13:51:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2010\/08\/09\/changing-the-projects-version\/"},"modified":"2010-08-09T13:51:00","modified_gmt":"2010-08-09T13:51:00","slug":"changing-the-projects-version","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2010\/08\/09\/changing-the-projects-version\/","title":{"rendered":"Changing the Projects Version"},"content":{"rendered":"<p>The following code may be used in the Macro Studio. It will update the AssemblyInfo files to reflect them with a given version. When the files are required to be chacked out, it will happen automatically.<\/p>\n<pre><br \/><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> <\/span><span style=\"color:#808080;\">&lt;summary&gt;<br \/><\/span><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> For all projects in the solution,<br \/><\/span><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> change the version to a given version<br \/><\/span><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> <\/span><span style=\"color:#808080;\">&lt;\/summary&gt;<\/span><span style=\"color:#008000;\"><br \/><\/span><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> <\/span><span style=\"color:#808080;\">&lt;remarks&gt;<\/span><span style=\"color:#008000;\">some items in the solution might produce an exception<br \/><\/span><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> for istance if they are not loaded, or they have no vesion<br \/><\/span><span style=\"color:#808080;\">'''<\/span><span style=\"color:#008000;\"> <\/span><span style=\"color:#808080;\">&lt;\/remarks&gt;<\/span><span style=\"color:#008000;\"><br \/><\/span><span style=\"color:#0000ff;\">Sub<\/span><span style=\"color:#000000;\"> ChangeVersionProperties()<br \/>   <\/span><span style=\"color:#0000ff;\">Dim<\/span><span style=\"color:#000000;\"> sol = DTE.Solution<br \/>   <\/span><span style=\"color:#0000ff;\">Dim<\/span><span style=\"color:#000000;\"> projectT <\/span><span style=\"color:#0000ff;\">As<\/span><span style=\"color:#000000;\"> EnvDTE.Project = sol.Projects.Item(<\/span><span style=\"color:#ff0000;\">1<\/span><span style=\"color:#000000;\">)<br \/>   <\/span><span style=\"color:#0000ff;\">Dim<\/span><span style=\"color:#000000;\"> newVersion <\/span><span style=\"color:#0000ff;\">As<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">String<\/span><span style=\"color:#000000;\"> = <\/span><span style=\"color:#800000;\">\"1.200.0.9\"<\/span><span style=\"color:#000000;\"><br \/><br \/>   <\/span><span style=\"color:#0000ff;\">For<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Each<\/span><span style=\"color:#000000;\"> project <\/span><span style=\"color:#0000ff;\">As<\/span><span style=\"color:#000000;\"> EnvDTE.Project <\/span><span style=\"color:#0000ff;\">In<\/span><span style=\"color:#000000;\"> sol.Projects<br \/>       <\/span><span style=\"color:#0000ff;\">Try<\/span><span style=\"color:#000000;\"><br \/>           Debug.Write(project.Name)<br \/>           Debug.Write(<\/span><span style=\"color:#800000;\">\" changes from \"<\/span><span style=\"color:#000000;\">)<br \/>           Debug.Write(project.Properties.Item(<\/span><span style=\"color:#800000;\">\"AssemblyFileVersion\"<\/span><span style=\"color:#000000;\">).Value)<br \/>           Debug.WriteLine(<\/span><span style=\"color:#800000;\">\" to \"<\/span><span style=\"color:#000000;\"> + newVersion)<br \/>           project.Properties.Item(<\/span><span style=\"color:#800000;\">\"AssemblyFileVersion\"<\/span><span style=\"color:#000000;\">).let_Value(newVersion)<br \/>       <\/span><span style=\"color:#0000ff;\">Catch<\/span><span style=\"color:#000000;\"> ex <\/span><span style=\"color:#0000ff;\">As<\/span><span style=\"color:#000000;\"> Exception<br \/>           System.Windows.Forms.MessageBox.Show(project.Name + <\/span><span style=\"color:#800000;\">\" kon niet gezet worden: \"<\/span><span style=\"color:#000000;\"> + ex.Message)<br \/>       <\/span><span style=\"color:#0000ff;\">End<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Try<\/span><span style=\"color:#000000;\"><br \/>   <\/span><span style=\"color:#0000ff;\">Next<\/span><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">End<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Sub<\/span><span style=\"color:#000000;\"><br \/><\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The following code may be used in the Macro Studio. It will update the AssemblyInfo files to reflect them with a given version. When the files are required to be chacked out, it will happen automatically. &#8221;&#8217; &lt;summary&gt;&#8221;&#8217; For all projects in the solution,&#8221;&#8217; change the version to a given version&#8221;&#8217; &lt;\/summary&gt;&#8221;&#8217; &lt;remarks&gt;some items in &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2010\/08\/09\/changing-the-projects-version\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Changing the Projects Version&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[63,56],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"The following code may be used in the Macro Studio. It will update the AssemblyInfo files to reflect them with a given version. When the files are required to be chacked out, it will happen automatically. ''' &lt;summary&gt;''' For all projects in the solution,''' change the version to a given version''' &lt;\/summary&gt;''' &lt;remarks&gt;some items in&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/68"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}