{"id":254,"date":"2009-11-19T18:37:07","date_gmt":"2009-11-19T10:37:07","guid":{"rendered":"\/wp\/post\/254.html"},"modified":"2009-11-19T18:37:07","modified_gmt":"2009-11-19T10:37:07","slug":"installshield%e5%88%a4%e6%96%addotnetframework%e6%8c%87%e5%ae%9a%e7%89%88%e6%9c%ac%e6%98%af%e5%90%a6%e5%ae%89%e8%a3%85%e7%9a%84%e8%84%9a%e6%9c%ac%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/lordong.xyz\/wp\/post\/254.html","title":{"rendered":"InstallShield\u5224\u65adDotNetFramework\u6307\u5b9a\u7248\u672c\u662f\u5426\u5b89\u88c5\u7684\u811a\u672c\u4ee3\u7801"},"content":{"rendered":"<p>\/\/ @param szVersion Version to check, e.g. &quot;v2.0&quot;, &quot;v3.5&quot; and so on.<\/p>\n<p>function DetectDotNet(szVersion) <br \/>&nbsp;&nbsp;&nbsp; NUMBER nRootKey, nResult;<br \/>&nbsp;&nbsp;&nbsp; LIST lstVersions;<br \/>&nbsp;&nbsp;&nbsp; BOOL bRet;<br \/>&nbsp;&nbsp;&nbsp; STRING szString;<br \/>begin<br \/>&nbsp;&nbsp;&nbsp; bRet = FALSE;<br \/>&nbsp;&nbsp;&nbsp; nRootKey = HKEY_LOCAL_MACHINE;<br \/>&nbsp;&nbsp;&nbsp; lstVersions = ListCreate(STRINGLIST);<br \/>&nbsp;&nbsp;&nbsp; if (lstVersions = LIST_NULL) then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox (&quot;Unable to create necessary lists.&quot;, SEVERE);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abort;<br \/>&nbsp;&nbsp;&nbsp; endif;<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if (RegDBSetDefaultRoot(nRootKey) = 0) then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nResult = RegDBQueryKey(&quot;SOFTWARE\\\\Microsoft\\\\NET Framework Setup\\\\NDP&quot;, <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; REGDB_KEYS, lstVersions);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nResult = 0) then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ Get the first string in the list.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nResult = ListGetFirstString(lstVersions, szString);<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ Loop while list items continue to be retrieved.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (nResult != END_OF_LIST)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ Detect the current element.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (StrFind(szString, szVersion) = 0) then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bRet = TRUE;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nResult = END_OF_LIST;&nbsp; \/\/ Force to exit<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ Get the next string in the list.<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nResult = ListGetNextString(lstVersions, szString);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; endif;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; endwhile;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; endif;<br \/>&nbsp;&nbsp;&nbsp; endif;<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; ListDestroy(lstVersions);&nbsp;&nbsp; <\/p>\n<p>&nbsp;&nbsp;&nbsp; return bRet;<br \/>end;<\/p>\n<p>\u65e0\u4eba\u503c\u5b88\u5b89\u88c5.Net Framework 3.5\u7684\u6279\u5904\u7406\u811a\u672c\uff08\u4f20\u5165\u53c2\u6570\u662fdotnetfx35.exe\u6240\u5728\u7684\u7edd\u5bf9\u76ee\u5f55\uff0c\u89e3\u51b3\u81ea\u52a8\u8fde\u7f51\u4e0b\u8f7d\u7684\u95ee\u9898\uff09\uff1a<\/p>\n<p>@echo off<br \/>setlocal<\/p>\n<p>set INSTALLER31=&quot;%~1WindowsInstaller-KB893803-v2-x86.exe&quot;<br \/>set DOTNETFX35=&quot;%~1dotnetfx35.exe&quot;<br \/>set NDP35SP1=&quot;%~1NDP35SP1-KB958484-x86.exe&quot;<\/p>\n<p>echo Installing %INSTALLER31%<br \/>%INSTALLER31% \/quiet \/norestart \/nobackup<\/p>\n<p>echo Extracting %DOTNETFX35%<br \/>%DOTNETFX35% \/x:%TEMP% \/passive<\/p>\n<p>cd \/d &quot;%TEMP%\\wcu\\dotNetFramework&quot;<\/p>\n<p>echo Installing dotNetFx35setup.exe<br \/>dotNetFx35setup.exe \/lang:ENU \/norestart \/passive<\/p>\n<p>echo Removing extracted files<br \/>cd \/d &quot;%TEMP%&quot;<br \/>rd \/s \/q wcu<\/p>\n<p>echo Installing %NDP35SP1%<br \/>%NDP35SP1% \/norestart \/passive<\/p>\n<p>endlocal<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ @param szVersion Version to check, e.g. &quot;v2.0&#038;q [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[66],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-6","tag-66"],"_links":{"self":[{"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/comments?post=254"}],"version-history":[{"count":0,"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/posts\/254\/revisions"}],"wp:attachment":[{"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/media?parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/categories?post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lordong.xyz\/wp\/wp-json\/wp\/v2\/tags?post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}