cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
blood_on_ice
Level 4

CtrlGetText .Net Call Problem

Hello,

I have a problem when I use the String from a CtrlGetText-Function in the call of my .net DLL. Here's the code:

Setup.rul:

//Includes
#include "DlgCertificate.rul"
...
//Global variables
STRING szDeployPath;
...
function OnInstallFilesActionAfter()
OBJECT oObj;
begin
szDeploymentManifest = INSTALLDIR + "\xxx.application";
szApplicationManifest = INSTALLDIR + "\xxx_xx_xx_xx_xx\xxx.manifest";
szApplicationManifestPath = INSTALLDIR + "\xxx_xx_xx_xx_xx";
set oObj = DotNetCoCreateObject(SUPPORTDIR ^ "InstallationSupport.dll", "InstallationSupport","");
oObj.setDeploymentUrlDeploymentManifest(szDeploymentManifest, szDeployPath);
end;
...


DlgConfiguration.rul:

//Defines
#define EDIT_DEPLOY_PATH 304
...
CtrlGetText(DLG_CONFIGURATION_DIALOG, EDIT_DEPLOY_PATH, szDeployPath);
...


When I use the Variable "szDeployPath" filled by the CtrlGetText Action, my DLL writes the following to my manifest file (the DLL is used to write text in a deployment-manifest file [clickonce]):


When I set the Variable myself before the call of the function:
szDeployPath = "\\\\deploymentServer\\test";
oObj.setDeploymentUrlDeploymentManifest(szDeploymentManifest, szDeployPath);


...all works fine. When I use an .exe file instead of my .net DLL with the same code and call it in the command-line -> all works fine. So the .net code should be fine...anyway heres the code of my .net dll:

using System;
using System.IO;
using Microsoft.Build.Tasks.Deployment.ManifestUtilities;
using System.Security.Cryptography.X509Certificates;

///
/// Summary description for clickOnceActions
///

public class InstallationSupport
{
public void setDeploymentUrlDeploymentManifest(string deploymentManifest, string newDeploymentUrl)
{
// Open the deployment file (.application)
DeployManifest deployManifest = ManifestReader.ReadManifest(deploymentManifest, false) as DeployManifest;

// Set the URL to the new url:
deployManifest.DeploymentUrl = newDeploymentUrl;

// Create a new manifest file
ManifestWriter.WriteManifest(deployManifest, deploymentManifest);

return newDeploymentUrl;
}
...
}


I've also tried to parse the variable with ParsePath ( szDeployPath, szDeployPath, PATH ); -> the same problem...

When I look at the szDeployPath-Variable, first filled with CtrlGetText, second setted by myself, I don't see any differences:

	MessageBox("CtrlGetText: " + szDeployPath, INFORMATION);
szDeployPath = "\\\\deploymentServer\\test";
MessageBox("Self setted: " + szDeployPath, INFORMATION);


Sorry, a lot of text:) But i'm getting crazy on this issue, I hope someone can help me...

Kind regards,
Peter
Labels (1)
0 Kudos
(7) Replies
RobertDickau
Flexera Alumni

One possible starting point; in your first block of code, where you have:

INSTALLDIR + "\xxx.application";

perhaps use this instead (^ instead of +, no leading backslash):

INSTALLDIR ^ "xxx.application";
0 Kudos
blood_on_ice
Level 4

RobertDickau wrote:
One possible starting point; in your first block of code, where you have:

INSTALLDIR + "\xxx.application";

perhaps use this instead (^ instead of +, no leading backslash):

INSTALLDIR ^ "xxx.application";


thanks for the quick answer...i've tried this:

szDeploymentManifest = INSTALLDIR ^ "\Ch.ZeitAg.System7.Client.Smart.application";

-> the same problem...I think the problem is szDeployPath, not the other variable (path to the file)

😞

Kind regards,
Peter
0 Kudos
blood_on_ice
Level 4

short update:

I've stored my string "\\\\deploymentServer\\system7" in a msi property (CUSTOM_DEPLOY_PATH) and get it into szDeployPath before my .net Call:

MsiGetProperty(ISMSI_HANDLE, "CUSTOM_DEPLOY_PATH", szDeployPath, nLength);
oObj.setDeploymentUrlDeploymentManifest(szDeploymentManifest, szDeployPath);


-> the same problem...

😞

Any other ideas to solve my problem?

Kind regards,
Peter
0 Kudos
blood_on_ice
Level 4

Hello,

sorry for my third reply here, but I need a solution for this. Does anyone has another idea where the problem could be located? What should I try?

Kind regards,
Peter
0 Kudos
RobertDickau
Flexera Alumni

The C# strings might maintain the \0 padding from the InstallScript strings; perhaps use String.Remove in the .NET code to remove the padding?
0 Kudos
blood_on_ice
Level 4

Thanks, I will try this...

Kind regards,
Peter
0 Kudos
sspencer
Level 4

Was a solution every found to this?
0 Kudos