Change the connection string in app.config with InstallShield 2011 setup - installation

I'm creating an InstallShield 2011 basic MSI installer project.
I'm trying to change the connection string in my app.config according to the user selections from the database login dialog made in the setup. How can I apply these connection string settings to the connection string entry in the app.config of my windows application I'm trying to install?
XML File Change is the right place to start from. Since changing the connection string is a common task my hope was that there is a best practice to do exactly this task.
-- edit --
There are two main difficulties:
How do I reference a file in InstallShield which will be created on build? The App.config gets copied to MyAppName.config. I don't want to hardwire the application name into the setup at this place again.
The connection string in the config file is used by Entity framework, thus contains more information than given by the database selection from InstallShield. I have to patch an attribute within an element of the config file, if I just want to change the Server and InitialCatalog properties of the connection string. It looks like XML File Change only supports replacing of an entire element or attribute.

As far as I remember, the XML File Changes is designed for this purpose. You can place the user's choice as a property value when defining your XPath and element/attribute values. For me, it was one of the areas of InstallShield which worked quite good and as described.

Related

IStringLocalizer create resx files

I want to add some translations to my Blazor web application. Upon research I found a great way to do this is using IStringLocalizer like described here.
However I find it hard to manually create the *.resx files. I mean every class has a localizer instance via
#inject Microsoft.Extensions.Localization.IStringLocalizer<MyPage> _localizer
and text is translated like this
#_localizer["This is a translated text."]
Now is there a way to execute a command in Developer Command Prompt with a given language in order to automatically create translation files for all localizer instances, so files like Resources\MyPage.en.resx and Resources\MyPage.de.resx and so on are created and can be translated?

Deploying solution from Dev to Production fails because column with same schema name data type was changed. Object dependencies won't get deleted

So the column in question was a lookup column, which i deleted in the unmanaged solution, and mistakenly created a new column with the same name. Dynamics by default will use the same auto-generated schema name based on the display name. So when I go to import the unmanaged solution in my dev environment into the production environment as managed, obviously it throws an error because of the mismatched of data types per column schema name.
Error returned by Azure Pipeline
So I did the sensible next thing, and went to delete this column in my dev environment. But oh no! There are object dependencies which prevent me from deleting it, okay I look at which objects depend on this column, it is a form, i remove the column from the form, go to delete and oh no again! There is still a dependency on the form I just deleted the column from.
So what do I do? I can't change the column schema name, I can't change the data type back to the data type that's currently in the managed solution. Is this when I open up a microsoft support ticket? Hopefully someone here has some insight. Thanks!
The attribute can be associated with a custom control. Try removing this custom control using the classic form designer. It should be visible on one of the field property tabs.
If the attribute cannot be found anywhere on the form using the classic or modern form designer, try this:
Create a solution with this form only. Export the solution as unmanaged. Extract the customization.xml from the zip. Edit the xml and remove all references to your attribute. Paste the customization.xml into the zip and import and publish the solution.
The only way to delete a managed component is to upgrade the solution. In your case, you can delete the field and dependency in solution and apply the upgrade to target environment. Please noticed that all data in this field would get deleted when you apply the upgrade. You may check this link for more detail

Visual studio xsd set connection string to None

I want to set connection string for my DataSet to None, because i use string that i build in run time. So i do not want keep fake string in app.config, just tome make xsd compile. Is there any way to achieve this?
If i set None in designer its still turn it to existing connection string from config.
I use visual studio 2017.
The best way I've found to have the benefits of the XSD designer and be able to change the connection settings for staging and production is as follows: - NOTE: this works in VS 2012 ... think it should also in 2010 - Also, DataSets were created by dragging from the Server Explorer, which saves connection information in the class library app.config and Properties.Settings.settings which is used at design time.
1) For each DataTable, click on the TableAdapter header (below the attributes and above the methods) and look at the properties 2) Change the Connection Modifier to Public 3) Then, the code to access the table should be something like the following (where the class library is named DALib) ...
using DALib;
using System.Web.Configuration;
PriceData.averageSalePriceFDataTable priceTable;
DALib.PriceDataTableAdapters.averageSalePriceFTableAdapter priceAdapter
= new DALib.PriceDataTableAdapters.averageSalePriceFTableAdapter();
priceAdapter.Connection.ConnectionString
= WebConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;
priceTable = priceAdapter.GetData( ... parameters ...);
This uses the connection string in the class library for design and picks it from Web.config when running.
Hope I understood your problem correctly, let me know.

Visual studio 2010 - difference between Settings.settings and Resources.resx

simple question here. What is the difference between putting a string in Settings.settings and putting a string in Resources.resx ?
Regards
In Settings.setting the string will be placed in a config file, bassicaly a xml document which stores all kind of information your application needs to run. It's best practice to store configurable information in here. Also you can set the scope of the config value (application and user).
Application scoped config values will be shared among all users, while the user ones are limited to the current executing user of the application.
The .resx file is the place for storing all kinds of stuff your application needs to run, like images and so on. Files in here should be normally not editable by the user, its as the name states, a resource pool for your application. Also resources are also always global.

ASP.NET Membership Password Recovery E-mail [duplicate]

I am working on a simple portal application using the ASP.NET membership and login controls. I would like to use the PasswordRecovery control to send emails containing forgotten passwords, however my portal requires localization. I have an existing Content Management System that I am pulling the localized strings out of and I would like to link the PasswordRecovery control to that system.
But, it appears that the PasswordRecovery control will ONLY accept a .txt file for the email body...the property is PasswordRecovery1.MailDefinition.BodyFileName
I do not want to use a file on disk, I would like to use the localized content in my CMS.
Is there any way to do this? It occurred to me that I might be able to use the SendingMail event to send my OWN email through the normal System.Net namespace, but that seems sorta cludgy...
Any thoughts?
Thanks,
Max
Try handling the SendingMail event of the PasswordRecovery control. In that event, set the e.Message.Body and e.Message.Subject properties to your localized text.
Found this by googling "BodyFileName localization":
http://forums.asp.net/t/1118242.aspx:
Just bind the property to a key in
your page's localresource file. The
page's local resource file is the file
located in a subdirectory called
app_localresources in your page's
directory. Just use visual studio's
"tools -> create local resource"
option in design view for it be
created for you.
In that file, create a string
key/value pair with something like
Name: myBodyFileName
Value: myDefaultBodyFile.txt
Then bind this to the BodyFileName
property of the login control with
something like
'>
Then just create the sattelite local
resource files for other cultures and
map that key/value pair in those
resources to other body text files.
By the way, if you used visual studio
to create the resource file for you,
then the binding may have been done
for you automatticaly. Just search for
a
"MyChangePasswordControlResource1.BodyFileName"
key in the resource file or something
similar.
Regards, Jorge

Resources