InstallShield 2015 setup and update env path on Windows 10 - installshield

I’m using InstallShield 2015 SP1 with Basic MSI project
When installing my setup on Windows 10 machine, it seems that restart or logoff is needed for the path environment variable to be updated.
The path is updated with the .ism file under Environment Variables,
I tried using custom action that run this InstallScript code ( taken from InstallShield help ) to avoid restart but it didn’t helped, Any ideas ?
#define WM_WININICHANGE 0x001A
#define HWND_BROADCAST 0xffff
STRING szKey, szEnv;
WPOINTER pEnv;
begin
// Flush the registry to all applications.
szEnv = "Environment";
pEnv = &szEnv;
SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
end;

Just need to put the CA after InstallFinalize.

Related

Configuring Visual & Installer in VS 2022 for x64

My config screen:
Why is it that I can't select x64 in the list? In the Alarm Clock row there is Add / Edit in the drop-down list. But not for AlarmClockSetup.
I am posting step by step tutorial because Configuration in Visual Studio works differently than in Inno Setup:
Lets assume user wants to build 2 installers: for 32 and 64 bit OS (two separate setup.exe-s).
Define 2 Visual Studio Configuration(s) for this using standard Visual Studio Configuration manager dialog, choose any names for them you wish, I chose: "setup32" and "setup64", the result will look like this:
For EACH configuration define some symbol (called conf in this example) in Project Properties like this: conf=$(Configuration)
It is important to have this symbol set for EACH configuration
And now double check whether you have defined this symbol for EACH configuration
If symbol is not defined for some Configuration you receive "Error on line XXX: Undeclared identifier: conf."
Inno script to test the configuration:
[Setup]
AppName=InnoSetupProject1
AppVersion=1.0
DefaultDirName={pf}\InnoSetupProject1
DefaultGroupName=InnoSetupProject1
UninstallDisplayIcon={app}\InnoSetupProject1.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Output
OutputBaseFilename=InnoSetupProject1
PrivilegesRequired=lowest
[Files]
Source: "Script.iss"; DestDir: "{app}"
[Icons]
Name: "{group}\InnoSetupProject1"; Filename: "{app}\InnoSetupProject1.exe"
[Code]
// Place your code here...
procedure InitializeWIzard();
begin
MsgBox(ExpandConstant('Configuration: {#conf}'), mbinformation,mb_ok);
#if conf == "setup32"
MsgBox('This is setup32', mbinformation,mb_ok);
#endif
#if conf == "setup64"
MsgBox('This is setup64', mbinformation,mb_ok);
#endif
end;
How it works:
When you choose "setup32" in Configuration dropdown, the $(Configuration) MSBuild variable is initialized and set to "setup32".
This $(Configuration) is mapped to Symbol conf (defined in Project Properties) that can be used anywhere in the script.
Use it for conditioning the setup behaviour using pre-processor #if, for Pascal code or anywhere as {#conf}.
So when the configuration is set to setup32 and you build the script, the Inno pre-processor excludes the inappropriate parts from the script and only the correct message box is shown.
Use the #if for include/exclude files in your script, for [Setup] section directives, for defining the Output directory or anything, choose the Configuration and rebuild the setup.

Windows App Certification Kit hangs

I have developed windows 10 App and uploaded that to windows store. However, I wanted to apply Windows Certification App Kit. The testing hangs during these two stages;
Direct3D trim after suspend
In progress...
UTF-8 file encoding
In progress...
I don't use any of those features in my app, but I don't understand why it should hang during process?
Thank you!
I ran into this exact same issue:
"Direct3D trim after suspend In progress... UTF-8 file encoding In progress..."
Problem was that I didn't try to run the Release Version locally first. It didn't run because I used preprocessor directives like so:
public static LicenseInformation licenseInformation = null;
...
#if DEBUG
...
...
licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
licenseInformation = CurrentApp.LicenseInformation;
#endif
"CurrentApp" did cause an exception.. I use code like this now:
#if DEBUG
...
...
licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
try
{
licenseInformation = CurrentApp.LicenseInformation;
}
catch (Exception)
{
}
#endif
And when working with the licenseInformation somewhere I check if it is not null before I use it...
I also found some other issues (warnings) in my code by using "Run Code Analysis on Solution"..
So in my case it was a problem with my code.
WACK "Hangs" because it is waiting for the app to start.The problem occurs if you use packages that internally use native code. An example is SQLite (Written in C++).
SQLite for Universal Windows Platform requires this Directive to be included in Properties/Default.rd.xml. Otherwise the external code will throw exceptions when your app is run in native mode (Release build in Visual Studio).
<Type Name="System.Collections.ArrayList" Dynamic="Required All" />
For details about this directive and EntityFramework.Sqlite (EF7), see: https://docs.efproject.net/en/latest/platforms/uwp/getting-started.html

ClickOnce fails on download

OK, I have a similar problem as Download ClickOnce fails from setup.exe and Download ClickOnce fails from setup.exe , where I have deployed a ClickOnce installer for a desktop app I am selling.
Different than those examples, I am using Visual Studio 2012 (Pro Version). Using .Net 3.5. I am deploying on a hosted LINUX machine. It worked for me and other people running Windows 7 & 8, possibly earlier versions of Widnows. Then after running a few tests in Debug mode, I built and deployed in Release mode. Now, the auto-installer breaks when it gets to the spot where it wants to download the .application file. Here's the log file.
The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [InstallMode] = HomeSite {string}
Property: [NTProductType] = 1 {int}
Property: [ProcessorArchitecture] = AMD64 {string}
Property: [VersionNT] = 6.2.0 {version}
Running checks for package 'Microsoft Visual Basic PowerPacks 10.0', phase BuildList
Attempting to find 'Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=YADDAYADDA' in the Global Assembly Cache
AssemblyCheck: Error querying assembly info: -2147024894
Attempting to find 'Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=YADDAYADDA, processorArchitecture=msil' in the Global Assembly Cache
Assembly found at 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualBasic.PowerPacks.Vs\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.PowerPacks.Vs.dll'
Setting value '11.0.50727.1 {version}' for property 'VBPowerPacksInstalled'
The following properties have been set for package 'Microsoft Visual Basic PowerPacks 10.0':
Property: [VBPowerPacksInstalled] = 11.0.50727.1 {version}
Running checks for command 'VBPowerPacks\VisualBasicPowerPacksSetup.exe'
Result of running operator 'ValueExists' on property 'VBPowerPacksInstalled': true
Result of checks for command 'VBPowerPacks\VisualBasicPowerPacksSetup.exe' is 'Bypass'
'Microsoft Visual Basic PowerPacks 10.0' RunCheck result: No Install Needed
Running checks for package '.NET Framework 3.5 SP1', phase BuildList
Reading value 'SP' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5'
Read integer value 1
Setting value '1 {int}' for property 'DotNet35SP'
The following properties have been set for package '.NET Framework 3.5 SP1': Property: [DotNet35SP] = 1 {int}
Running checks for command 'DotNetFX35SP1\dotNetFx35setup.exe'
Result of running operator 'ValueGreaterThanEqualTo' on property 'DotNet35SP' and value '1': true
Result of checks for command 'DotNetFX35SP1\dotNetFx35setup.exe' is 'Bypass'
'.NET Framework 3.5 SP1' RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with HRESULT '-2146697205'
Error: An error occurred trying to download 'http://www.mywebsite.com/ProductName/Downloads/oneclick/ProductName.application'.
I've looked at https://msdn.microsoft.com/en-us/library/ms229001.aspx , after which I set the MIME type of .application to x-ms-application. No difference.
When I put the url http://www.mywebsite.com/ProductName/Downloads/oneclick/ProductName.application into my browser, I get the text of the file, rather than a download.
Any thoughts??? Thanks!
OK, the first thing that got me closer to the solution was simply to reboot the PC I was dwonloading onto. This got me further into the install, but I then ran into another problem, the solution to which I found at ClickOnce application replace current installed fliles . Clearing out the folder C:\Users\Charles\AppData\Local\Apps\2.0got me to where I could install and run the app fully.
Window application in C #. My solution, I hope it serves someone. The domain server was damaged, I just changed the IP of the new DNS server. It was not necessary to join that new domain server IP.
The "An error occurred trying to download.." error occurs with one of our click-once apps and the solution is to turn off IE Enhanced Security from Server Manager (Server 2012R2+) on the target machine.

SharePoint script fails when run as a Visual Studio post-deployment command

I have written a script that inserts some test data into a document library. I intend to use it as a post-deployment step in Visual Studio 2010, so that the library is not empty after a retract & deploy.
The relevant portions of the script are:
Install.ps1:
$scriptDirectory = Split-Path -Path $script:MyInvocation.MyCommand.Path -Parent
. "$scriptDirectory\Include.ps1"
$webUrl = "http://localhost/the_site_name"
$web = Get-SPWeb($webUrl)
...
Include.ps1:
function global:Get-SPSite($url)
{
return new-Object Microsoft.SharePoint.SPSite($url)
}
function global:Get-SPWeb($url,$site)
{
if($site -ne $null -and $url -ne $null){"Url OR Site can be given"; return}
#if SPSite is not given, we have to get it...
if($site -eq $null){
$site = Get-SPSite($url);
...
}
It works fine when run as follows from the command line, even immediately after a Visual Studio re-deploy:
powershell \source\ProjectFiles\TestData\Install.ps1
However, it does not work when I use the exact same command as a post-deployment command line in the SharePoint project's properties in Visual Studio:
Run Post-Deployment Command:
New-Object : Exception calling ".ctor" with "1" argument(s): "The Web applicati
on at http://localhost/the_site_name could not be found. Verify that you have t
yped the URL correctly. If the URL should be serving existing content, the syst
em administrator may need to add a new request URL mapping to the intended appl
ication."
At C:\source\ProjectFiles\TestData\Include.ps1:15 char:18
+ return new-Object <<<< Microsoft.SharePoint.SPSite($url)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
Interestingly, I can reproduce the error on the command line if I run:
c:\windows\Syswow64\WindowsPowerShell\v1.0\powershell \source\ProjectFiles\TestData\Install.ps1
However, the post-deployment command fails even if I explicitly run \windows\System32\WindowsPowerShell\v1.0\powershell and \windows\Syswow64\WindowsPowerShell\v1.0\powershell.
Update: Solution found
I seem to be having a similar problem to the one discussed here:
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/faa25866-330b-4e60-8eee-bd72dc9fa5be
I cannot access a 64-bit SharePoint API using 32-bit clients. Because Visual Studio is 32-bit, the post-deployment action will run in a 32-bit process and will fail. There is, however, a 64-bit MSBuild. If we let it run the PowerShell script, all is fine.
Wrap the script in an MSBuild file such as this:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Install" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Install">
<Exec Command="powershell .\Install" />
</Target>
</Project>
Then, set the post-deployment command line to:
%WinDir%\Microsoft.NET\Framework64\v4.0.30319\MSBuild $(SolutionDir)\ProjectFiles\TestData\Install.msbuild
Use
%WINDIR%\SysNative\WindowsPowerShell\v1.0\powershell.exe
It’s important that you use the virtual path of %WINDIR%\SysNative and not the actual
path of C:\Windows\System32. The reason for this is that Visual Studio 2010 is a 32-bit
application that needs to call the 64-bit version of powershell.exe to successfully load the
Microsoft.SharePoint.Powershell snap-in.
(c)"Inside Microsoft SharePoint 2010", Microsoft Press, Mar 2011
I had same situation, I needed the Post Deployment powershell script to create dummy data for lists on my local instance. I tried several other ways even using the MSBuild with the .msbuild file as suggested above, but i could not all the variables and had to hard code the file with path and url, this is not what i wanted.
I finally figured out a way to explicitly calling the 64-Bit powershell.exe
I know the 64-bit file has to be there on hard dirve. I know that WinSXS folder has all the files. So quick search for powershell.exe in C:\Windows\winsxs folder i got two files so i grabbed the path for one in amd64 folder.
This is what i have as command in post deployment option
C:\Windows\winsxs\amd64_microsoft-windows-powershell-exe_31bf3856ad364e35_6.1.7600.16385_none_c50af05b1be3aa2b\powershell.exe -command "&{$(ProjectDir)PowerShell\dataload.ps1 -xmlPath "$(ProjectDir)PowerShell\dataload.xml" -webUrl "$(SharePointSiteUrl)"}"
I hope this will help someone in future.
Visual Studio is a 32-bit application, so in 64-bit Windows it runs in a simulated 32-bit environment.
Strangely, the 32-bit environment is called "WoW64" (when 32-bit Windows did this for 16-bit apps, it was called "WoW16". The "WoW" part means "Windows on Windows".
It's similarly strange that "System32" didn't become "System64" with 64-bit Windows. The "32" is from the 16-bit -> 32-bit transition, to differentiate from "System". Whatever, that's legacy/compatibility for you.
In WoW64, everything looks like a 32-bit Windows.
For example, c:\windows\system32 just points to c:\windows\syswow64. 32-bit applications can't (easily) reach anything 64-bit.
It is possible to use PowerShell Remoting to get a 64-bit PowerShell session from a 32-bit environment.
PS>gci env:PROCESSOR_ARCH*
Name Value
---- -----
PROCESSOR_ARCHITECTURE x86
PROCESSOR_ARCHITEW6432 AMD64
PS>Invoke-Command -ConfigurationName Microsoft.PowerShell -ComputerName LOCALHOST { gci env:PROCESSOR_ARCH* }
Name Value PSComputerName
---- ----- --------------
PROCESSOR_ARCHITECTURE AMD64 localhost
I have success doing this as a post deployment command:
%comspec% /c powershell -File "c:\foo\bar.ps1"

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