Is it possible to send parameters to InstallShield prerequisites? - installshield

I am evaluating InstallShield 2010, and am trying to set some command line parameters to the SQL Server 2008 prerequisite at user runtime. It appears that the prerequisite is defined entirely in the .prq files (xml-style).
Wise for Windows used WiseScript to call the prerequisite installations. InstallAware seems to have something similar, with their own scripting. Does something similar exist for InstallShield?

We use IS v12; I built a .prq file for the purpose (they don't supply a .prq for SQL 2008 for IS v12). First I went to http://msdn.microsoft.com/en-us/library/ms144259.aspx to get all possible cmd line args. Then I used the IS PRQ editor to create the basic .prq structure. Then I hand-edited the .prq (xml) file for (a) easy minor adjustments in the future and (b) to simplify version control diffs.
<?xml version="1.0" encoding="utf-8"?>
<SetupPrereq>
<conditions>
<condition Type="16" Comparison="2" Path="[ProgramFilesFolder]Microsoft SQL Server\100\COM" FileName="sqlresld.dll" ReturnValue="2007.100.1600.22"/>
</conditions>
<files>
<file LocalFile="<ISProductFolder>\SetupPrerequisites\Microsoft SQL Server 2008 Express with Tools\SQLEXPRWT_x86_ENU.exe" CheckSum="BCC335711D44BAFC420B5165D2F04647" FileSize="0,229169680"/>
</files>
<execute file="SQLEXPRWT_x86_ENU.exe" requiresmsiengine="1"
cmdline ="/INSTANCEID=AV /INSTANCENAME=AV /ACTION=Install /FEATURES=SQLENGINE,SSMS /HELP=0 /ERRORREPORTING=0 /SQMREPORTING=0 /INDICATEPROGRESS=0 /QUIETSIMPLE=1 /FILESTREAMLEVEL=0 /ENABLERANU=1 /TCPENABLED=1 /NPENABLED=0 /ADDCURRENTUSERASSQLADMIN=1 /AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /AGTSVCSTARTUPTYPE=Manual /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /RSSVCSTARTUPTYPE=Automatic"
cmdlinesilent="/INSTANCEID=AV /INSTANCENAME=AV /ACTION=Install /FEATURES=SQLENGINE,SSMS /HELP=0 /ERRORREPORTING=0 /SQMREPORTING=0 /INDICATEPROGRESS=0 /QUIETSIMPLE=1 /FILESTREAMLEVEL=0 /ENABLERANU=1 /TCPENABLED=1 /NPENABLED=0 /ADDCURRENTUSERASSQLADMIN=1 /AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /AGTSVCSTARTUPTYPE=Manual /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /RSSVCSTARTUPTYPE=Automatic"
/>
<dependencies>
<dependency File="<ISProductFolder>\SetupPrerequisites\Microsoft Installer 4.5 for XP.prq"/>
<dependency File="<ISProductFolder>\SetupPrerequisites\Microsoft Installer 4.5 for Windows Server 2003 or 64 bit XP.prq"/>
<dependency File="<ISProductFolder>\SetupPrerequisites\Power Shell 1.0 for Windows XP.prq"/>
<dependency File="<ISProductFolder>\SetupPrerequisites\Power Shell 1.0 for Windows Server 2003.prq"/>
</dependencies>
<properties Id="Microsoft SQL Server 2008 Express with Tools" Description="This installs Microsoft SQL Server 2008 Express Edition (SQL Server Express). The /qn switch suppresses all Setup dialog boxes and error messages. See http://msdn2.microsoft.com/en-us/library/ms144259.aspx for more information about the commad line options. The SQL setup logs to %programfiles%\Microsoft SQL Server\100\Setup Bootstrap\Log\"/>
</SetupPrereq>

Yes - by right clicking on the SQL Server prerequisite -> "Application to Run"' tab -> "Specify the command line for the application".

The only way I know how to do this is to write a Helper.EXE that the PRQ calls. The EXE would need to detect the windows settings and silently pass the correct arguments to the real Prereq EXE/MSI.

Related

Web Package: How to force MSBuild to use MSDeploy.IisApp instead of sitemanifest?

How do I force MSBuild to create a Web Package that uses the iisApp Provider Application Path such as "Default Web Site/Catalog"?
My build process is creating a package that uses a directory path (C:\Agent\_work\28\s\Catalog).
I have tried to add the "/p:DeployAsIisApp=True" in my MSBuild command, but that doesn't seem to make a difference.
If I set the virtual directory to my Visual Studio 2017 solution folder, then Export a Package through IIS Manager, the package is created the way I'm expecting.
I compared the archive.xml files between MSBuild and the IIS Export. Here is some partial output:
MSBuild:
<sitemanifest MSDeploy.ObjectResolver.createApp= ...>
<iisApp path="C:\Agent\_work\28\s\Catalog ...>
...
</sitemanifest>
IIS Export:
<MSDeploy.IisApp MSDeploy.ObjectResolver.createApp= ...>
<iisApp path="Default Web Site/Catalog" ...>
...
</MSDeploy.IisApp />
So IIS is exporting MSDeploy.IisApp while MSBuild is creating a sitemanifest.
How do I get MSBuild to match the IIS Export? I'm using the VSTS build system and the parameters I'm passing to MSBuild are:
MSBuild /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\Catalog" /p:IncludeSetAclProviderOnDestination=False
I solved the issue.
The specific issue I had been experiencing was a line in the logs that looked like this:
Verbose: Parameter entry 'IIS Web Application Name/1' could not be applied anywhere.
Parameters.xml was this (broken):
<parameters>
<parameter name="IIS Web Application Name"
description="Full site path where you want to install the Catalog Application (for example, Default Web Site/Catalog)."
defaultValue="Default Web Site/Catalog"
tags="IisApp">
<parameterEntry kind="ProviderPath" scope="iisApp" match="#defaultValue" />
</parameter>
I set the match attribute to an empty string. Then everything started working as expected. Working:
<parameters>
<parameter name="IIS Web Application Name"
description="Full site path where you want to install the Catalog Application (for example, Default Web Site/Catalog)."
defaultValue="Default Web Site/Catalog"
tags="IisApp">
<parameterEntry kind="ProviderPath" scope="iisApp" match="" />
</parameter>

How can we deploy from TFS to IIS on shared hosting? (GoDaddy)

The documentation found here describes how to deploy to IIS, but the WinRM component requires local admin permissions. Obviously, this isn't going to be available on shared hosting with service providers such as GoDaddy. (We'll be excluding Azure targets for the purposes of this discussion.)
Visual Studio can do this very easily, simply by using an imported .publishsettings file. Doesn't it stand to reason that TFS should be able to do the same thing without needing the extra privileges?
...or are we simply out of luck when trying to use TFS to publish to non-Azure shared hosting configurations?
--EDIT--
I've been working on Patrick's suggested answer all day, and after countless combinations of configurations I'm still coming up empty. MSBuild does look like the way to go for this, yes, but I can't get it working on my TFS 2018.
The output from the Release task is below. As we can see, MSBuild refuses to publish the site to my local testing IIS.
The strange thing is that MSBuild publishes as expected when I run the command from the logs below from a command window on my local workstation (after adjusting for the relevant file paths, of course, and removing the /dl:CentralLogger switch).
One of the things I tried was to edit/delete files on the source/target, to try to force a sync. That didn't work either.
Does anyone see any indication why this isn't working?
Log
2018-02-27T04:48:38.4708105Z ##[section]Starting: Build solution $(System.DefaultWorkingDirectory)/Website/drop/Website.vbproj
2018-02-27T04:48:38.4938123Z ==============================================================================
2018-02-27T04:48:38.4938123Z Task : Visual Studio Build
2018-02-27T04:48:38.4938123Z Description : Build with MSBuild and set the Visual Studio version property
2018-02-27T04:48:38.4938123Z Version : 1.120.0
2018-02-27T04:48:38.4938123Z Author : Microsoft Corporation
2018-02-27T04:48:38.4938123Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613727)
2018-02-27T04:48:38.4938123Z ==============================================================================
2018-02-27T04:48:41.0024890Z ##[command]"D:\Agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
2018-02-27T04:48:41.7115427Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" "D:\Agent\_work\r5\a\Website\drop\Website.vbproj" /nologo /nr:false /dl:CentralLogger,"D:\Agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=6e6502d0-9bea-46af-a5a7-9dac551b9e29|SolutionDir=D:\Agent\_work\r5\a\Website\drop"*ForwardingLogger,"D:\Agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:AllowUntrustedCertificate=true /p:PublishProfile="D:\Agent\_work\r5\a\Website\drop\My Project\PublishProfiles\QA.pubxml" /p:Password=******** /p:platform="AnyCPU" /p:configuration="release" /p:VisualStudioVersion="15.0" /p:_MSDeployUserAgent="TFS_1c911c00-1ecd-4ca9-87b0-d8d34f8c59c4_release_2_24_24_1"
2018-02-27T04:48:42.3456044Z Build started 2/26/2018 7:48:42 PM.
2018-02-27T04:48:44.0457237Z Project "D:\Agent\_work\r5\a\Website\drop\Website.vbproj" on node 1 (default targets).
2018-02-27T04:48:44.0487239Z CoreResGen:
2018-02-27T04:48:44.0487239Z No resources are out of date with respect to their source files. Skipping resource generation.
2018-02-27T04:48:44.2587401Z CoreCompile:
2018-02-27T04:48:44.2597397Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\vbc.exe /noconfig /imports:Intexx,Intexx.Linq,Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.ComponentModel,System.Data,System.Data.Common,System.Data.Entity,System.Data.Entity.Migrations,System.Data.SqlClient,System.IO,System.Linq,System.Xml.Linq,System.Diagnostics,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls /optioncompare:Binary /optionexplicit+ /optionstrict:custom /nowarn:42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 /optioninfer+ /nostdlib /rootnamespace:Website /sdkpath:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7" /highentropyva+ /doc:obj\release\Website.xml /define:"CONFIG=\"release\",TRACE=-1,_MyType=\"Custom\",PLATFORM=\"AnyCPU\"" /reference:D:\Agent\_work\r5\a\Website\drop\bin\EntityFramework.dll,D:\Agent\_work\r5\a\Website\drop\bin\EntityFramework.SqlServer.dll,D:\Agent\_work\r5\a\Website\drop\bin\Intexx.Core.dll,D:\Agent\_work\r5\a\Website\drop\bin\itxcorlib.dll,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.ComponentModel.DataAnnotations.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Configuration.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Core.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Data.DataSetExtensions.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Data.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Drawing.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.EnterpriseServices.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Web.ApplicationServices.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Web.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Web.DynamicData.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Web.Entity.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Web.Extensions.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Web.Services.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Xml.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Xml.Linq.dll" /debug+ /debug:pdbonly /optimize+ /out:obj\release\Website.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /resource:obj\release\Website.Migrations._001.resources /resource:obj\release\Website.Resources.resources /target:library /utf8output App_Code\Enums.vb Bill.aspx.designer.vb Bill.aspx.vb Contact.aspx.designer.vb Contact.aspx.vb Default.aspx.designer.vb Default.aspx.vb Defects.aspx.designer.vb Defects.aspx.vb Donate.aspx.designer.vb Donate.aspx.vb Forum.aspx.designer.vb Forum.aspx.vb Jackson.aspx.designer.vb Jackson.aspx.vb Key.aspx.designer.vb Key.aspx.vb Laws.aspx.designer.vb Laws.aspx.vb Letters.aspx.designer.vb Letters.aspx.vb Losers.aspx.designer.vb Losers.aspx.vb Main.Master.designer.vb Main.Master.vb MenuItem.ascx.designer.vb MenuItem.ascx.vb Migrations\201802040108464_001.Designer.vb Migrations\201802040108464_001.vb Migrations\Configuration.vb Migrations\Defaults.vb Models\Db\Context.vb Models\Db\Loser.vb Models\Db\NewsItem.vb "My Project\AssemblyInfo.vb" "My Project\Application.Designer.vb" "My Project\MyExtensions\MyWebExtension.vb" "My Project\Resources.Designer.vb" "My Project\Settings.Designer.vb" News.aspx.designer.vb News.aspx.vb Oops.aspx.designer.vb Oops.aspx.vb Pocket.aspx.designer.vb Pocket.aspx.vb Seventeenth.aspx.designer.vb Seventeenth.aspx.vb States.aspx.designer.vb States.aspx.vb Store.aspx.designer.vb Store.aspx.vb "D:\Agent\_work\_temp\.NETFramework,Version=v4.7.AssemblyAttributes.vb"
2018-02-27T04:48:44.2917430Z Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn
2018-02-27T04:48:44.5307644Z
2018-02-27T04:48:44.5357653Z _CopyFilesMarkedCopyLocal:
2018-02-27T04:48:44.5357653Z Touching "D:\Agent\_work\r5\a\Website\drop\obj\release\Website.vbproj.CopyComplete".
2018-02-27T04:48:44.5567658Z CopyFilesToOutputDirectory:
2018-02-27T04:48:44.5577603Z Copying file from "obj\release\Website.dll" to "bin\Website.dll".
2018-02-27T04:48:44.5587611Z Website -> D:\Agent\_work\r5\a\Website\drop\bin\Website.dll
2018-02-27T04:48:44.5597611Z Copying file from "obj\release\Website.pdb" to "bin\Website.pdb".
2018-02-27T04:48:44.5607636Z Copying file from "obj\release\Website.xml" to "bin\Website.xml".
2018-02-27T04:48:44.5967639Z Done Building Project "D:\Agent\_work\r5\a\Website\drop\Website.vbproj" (default targets).
2018-02-27T04:48:44.6257666Z
2018-02-27T04:48:44.6257666Z Build succeeded.
2018-02-27T04:48:44.6257666Z 0 Warning(s)
2018-02-27T04:48:44.6257666Z 0 Error(s)
2018-02-27T04:48:44.6257666Z
2018-02-27T04:48:44.6257666Z Time Elapsed 00:00:02.29
2018-02-27T04:48:44.6868621Z ##[section]Finishing: Build solution $(System.DefaultWorkingDirectory)/Website/drop/Website.vbproj
QA.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://www.website.local</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>https://server3:8172/msdeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>website</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>DOMAIN\User</UserName>
<_SavePWD>True</_SavePWD>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="Website.Db.Context" Order="1" Enabled="False">
<Destination Path="" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="Website.Db.Context, Website" MigrationConfiguration="Website.Migrations.Configuration, Website" />
</Object>
</ObjectGroup>
<ObjectGroup Name="Website.My.MySettings.DbConnectionString" Order="2" Enabled="False">
<Destination Path="" />
<Object Type="DbDacFx">
<PreSource Path="Data Source=(local);Initial Catalog=Website;Integrated Security=False;Persist Security Info=False;User ID=username;Password=password" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\Website.My.MySettings.DbConnectionString_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="Data Source=(local);Initial Catalog=Website;Integrated Security=False;Persist Security Info=False;User ID=username;Password=password" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)Website.Db.Context-Web.config Connection String" />
</ItemGroup>
<ItemGroup>
<_ConnectionStringsToInsert Include="Website.Db.Context" />
</ItemGroup>
</Project>
Unlike Azure, setting up a continuous deployment from VSTS/TFS to these priced hosting servers do not have a built-in solution.
And this is bidirectional issue, TFS also greet other platform provide their official extension as a 3-party task in Marketplace. You could submit a uservoice in their site.
As a workaround, TFS is also using MSBuild in the build agent to perform build. .publishsettings also related to Azure. If you could use Web Deploy with GoDaddy locally through Visual Studio. It' should also be able to do this in TFS.
Take a look at this tutorial, using below MSBuild Argument:
/p:DeployOnBuild=true /p:PublishProfile="sitename.com - Web Deploy.pubxml" /p:AllowUntrustedCertificate=true /p:UserName="uname" /p:Password="password" /p:VisualStudioVersion=14.0
More details please refer this tutorial: HOW TO SETUP VSTS CONTINUOUS DEPLOYMENT FOR GODADDY
But according to this discussion, seems even directly using Visual Studio Web Deploy to handle with the GoDaddy is also not so stability. If you get same issue, you may deal with their support.
It turned out that I didn't have the full VS toolset installed on the server. I'd only installed the bare minimum, as I didn't need anything more than the VSTest capability.
So I updated and installed Web and Desktop this time, and the deployment sailed right through.
Credits to Microsoft Support Services for helping me with this.

read xml file with powershell in windows server 2003

can you please help me with this code below?
[System.Xml.XmlDocument]$xd = New-Object System.Xml.XmlDocument
$file = "C:\PS\SetUP.xml";
$xd.LoadXml($file);
#$root = $xd.DocumentElement
Write-Host $xd.SelectSingleNode("/Setup").Attributes.GetNamedItem("WebAppUrl").Value
This code works fine when I run it in windows server 2008, but it does not work in windows server 2003.
I tested it in C# in the same environment (win server 2003) and it works, but not in Powershell.
I think there could be some Powershell version issue.
Could you please help me?
Thank you
Xml file
<?xml version="1.0" encoding="utf-8"?>
<Setup WebAppUrl="http://sp2007">
<SiteCollection Name="Report" Url="Report Requests">
<Lists>
<List Name="Report Requests" Url="ReportRequests" />
<List Name="Report Request Tasks" Url="ReportRequestTasks" />
</Lists>
<Features>
<Feature>ContentTypeSyndication</Feature>
</Features>
<Site Name="Child 1" Url="child1" Template="STS#0"/>
<Site Name="Child 2" Url="child2" Template="STS#0"/>
<Site Name="Child 3" Url="child3" Template="STS#0"/>
</SiteCollection>
</Setup>
I don't have v1 but you can read xml files and navigate them the same way regardless of OS version. Can you share the xml file?
[xml]$xd = Get-Content C:\PS\SetUP.xml
$xd.SelectSingleNode("/Setup").WebAppUrl
http://sp2007
If there's only one Setup node then you can get the value with:
$xd.Setup.WebAppUrl
The Powershell version on Windows 2003 is 1.
The version on Windows 2008 is 2.
Link: http://en.wikipedia.org/wiki/Windows_PowerShell#Versions
Simple as that. You can try to upgrade it AFAIK.
Edit: Update procedure -> http://maxt2posh.wordpress.com/2009/12/23/update-powershell-v1-to-v2-windows-management-framework/

RoleEnvironment initialization in Azure on IIS x64 bit throws an error

I created webservice that runs under IIS, and it is x64 bit. I deployed it with custom install script on Azure machine (ws2008 r2). I created custom app pool (64 bit, Managed pipeline mode: Classic, .net v2, with NetworkService account as service user). Everything seems to be configured correctly but when I try to run my application I get following error:
System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception. ---> System.TypeInitializationException: The type initializer for '' threw an exception. ---> .ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
I can run standalone win form application and this method works correctly. What is more when I switch app pool to 32 bit and I run my application then it fail (because it has x64 bit components), however later when switch back to x64 it works correctly, RoleEnvironment returns correct data.
Do you have any ideas what can I do wrong when it comes to configuration, so this module cannot be loaded in x64 bit version?
This may help. You can add a start-up task to your Windows Azure project's .csdef file to configure IIS to allow 32-bit modules in 64-bit applications.
In your Windows Azure project .csdef file:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition>
<WebRole ...>
...
<Startup>
<Task commandLine="ConfigureIIS.cmd" executionContext="elevated" taskType="simple" />
</Startup>
</WebRole>
</ServiceDefinition>
ConfigureIIS.cmd (all one line):
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true
I believe you would need to install VC++ x64 runtime in your Azure VM via startup task as some of the references you are using need VC++ run time.

How to install SQL Server 2008 Express with Inno Setup?

anyone have script or procedures to install SQL Server 2008 Express, set up the database for the app and finally install a client .NET WinForm application?
In situations like this where I'm relying on third-party products (SQL Server Express), I tend to use command-line driven installs (either directly in a cmd file or called from a 'proper' install tool). This site shows you how to install Express from the command line, then you can use the SQL Express utility for object creation. This method is 'blessed' by Microsoft.
Sometimes the simplest solution is the best, even if that means getting the user of my product to install SQL Express separately before running my install. Well, best for me, anyway :-)
The following script will check for the full version of SQL Server 2008 R2. If full version is already installed, then it skips installing the SQL Server. If the full version is not installed, then it checks for the SQL Express edition. If it is already installed, it will skip the installation. If it is not installed, then it will install SQL Express 2008 R2.
Create a new script. Let's name it sql2008express.iss with the following content
[CustomMessages]
sql2008r2expressx86_title=Microsoft SQL Server 2008 R2 Express Edition x86 (Including Tools)
sql2008r2expressx64_title=Microsoft SQL Server 2008 R2 Express Edition x64 (Including Tools)
sql2008r2expressx86_size=235.5 MB
sql2008r2expressx64_size=247.5 MB
[Code]
const
sql2008r2expressx86_url='http://download.microsoft.com/download/5/5/8/558522E0-2150-47E2-8F52-FF4D9C3645DF/SQLEXPRWT_x86_ENU.exe';
sql2008r2expressx64_url='http://download.microsoft.com/download/5/5/8/558522E0-2150-47E2-8F52-FF4D9C3645DF/SQLEXPRWT_x64_ENU.exe';
procedure sql2008express();
var
version: string;
begin
// Check if the full version fo the SQL Server 2008 R2 is installed
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLSERVER\MSSQLServer\CurrentVersion', 'CurrentVersion', version);
if (version < '10.5') or (version = '') then begin
// If the full version is not found then check for the Express edition
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion', 'CurrentVersion', version);
if (version < '10.5') (*or (version > '9.00') or (version = '') *) then begin
if isX64() then
AddProduct('SQLEXPRWT_x64_ENU.exe', '/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL,AS,RS,IS,Tools /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\Administrators" /INDICATEPROGRESS /TCPENABLED=1 /BROWSERSVCSTARTUPTYPE=Automatic /ERRORREPORTING=0 /SQMREPORTING=0 /SECURITYMODE=SQL /SAPWD=1234', CustomMessage('sql2008r2expressx64_title'), CustomMessage('sql2008r2expressx64_size'), sql2008r2expressx64_url,false,false)
else
AddProduct('SQLEXPRWT_x86_ENU.exe', '/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL,AS,RS,IS,Tools /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\Administrators" /INDICATEPROGRESS /TCPENABLED=1 /BROWSERSVCSTARTUPTYPE=Automatic /ERRORREPORTING=0 /SQMREPORTING=0 /SECURITYMODE=SQL /SAPWD=1234', CustomMessage('sql2008r2expressx86_title'), CustomMessage('sql2008r2expressx86_size'), sql2008r2expressx86_url,false,false);
end;
end;
end;
In your script then just include the script i nthe [Run] tag and call the previous created script in the [Code] tag like below:
[Run]
`#include "scripts\sql2008express.iss"
[Code]
sql2008express();
Other notes:
- If the setup kits for the SQL are found in the same folder then it will use them, if not, they will be downloaded from the Internet.
- Sorry for the formating, it doesn't work. Copy/paste it in a text editor and format it. It is complete and working.
I hope this will help others too. :)

Resources