How to update .config file which is present in .xap folder - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

sagar
Posts: 39
Joined: Tue Dec 13, 2011 2:53 pm

How to update .config file which is present in .xap folder

Hello,
I am creating installer for silverlight web project.When I install my project on any machine, I want to update the service url which is present in ServiceReferences.ClientConfig.
At this moment I am not able to update this file because ServiceReferences.ClientConfig file is present in SilverlightApplication.xap folder.
Please tell me how to update service url i.e

Code: Select all

<endpoint address="http://192.168.8.220/TH5WCF1/Locations/LocationsService.svc"
    binding="customBinding" bindingConfiguration="CustomBinding_ILocationsService"
    contract="LocationsService.ILocationsService" name="CustomBinding_ILocationsService" />
I.P. address 192.168.8.220 to machine I.P. address where I am installing my web project
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to update .config file which is present in .xap fold

Hello,

The answer to your question is in this post.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sagar
Posts: 39
Joined: Tue Dec 13, 2011 2:53 pm

Re: How to update .config file which is present in .xap fold

Hello,
I can not use InitParams because I am not deploying my silverlight application I am deploying WCF project & web project only. I got silverlight application in web project-> clintBin folder as SilverlightApplication.xap.
So all the refrances of WCF services is present in ServiceReferences.ClientConfig file which is stored in SilverlightApplication.xap.
I want to update ServiceReferences.ClientConfig file to change service url.
Please give me solution to update that file at the time of installation.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to update .config file which is present in .xap fold

Hi,

Since the config file is found int the .xap one, which is actually an archive, the only method to update it during the install is to create a custom action, for example and EXE/DLL in .NET. The custom action should be scheduled under "InstallIIS" standard action, as "Deferred with no impersonation", so it is executed after the files were placed on the machine, with full admin rights.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sagar
Posts: 39
Joined: Tue Dec 13, 2011 2:53 pm

Re: How to update .config file which is present in .xap fold

Hello Bogdan,
Thank you for your replay.
Now I got the code to modify ServiceReferences.ClientConfig file at the time of installation.I refereed tutorial which is present in
http://www.silverlightshow.net/items/Bu ... ation.aspx
I have written the code in one shared method in classlibrary, I want to call that method in installer so that it will update the file .
1>Please tell me the way to call that method using custom action of InstallExecuteSequence.

Code: Select all

2> Please tell me how to pass application folder path in which I am storing my project to dll function as a parameter.
sagar
Posts: 39
Joined: Tue Dec 13, 2011 2:53 pm

How to call function from standard dll

Hi,
I have created one class library project in which I have written the function to update .config file.When I called that function by adding call function from standard dll custom action.When I try to install my web project installer is throwing "Function UpdateURL not found in dll" error message.
Please tell solution for above problem.I have attached the .api file with this post.
Attachments
Demo.aip
Demo project
(36.37 KiB) Downloaded 470 times
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to update .config file which is present in .xap fold

Here you can see my reply:
http://www.advancedinstaller.com/forums ... 204#p49127

Also, the property that stores the install path is "APPDIR", which you can pass as a parameter if you are using the method "Call function from standard DLL" or read it directly from the fledged C# custom action, as explained in my answer.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”