Generic Visual studio solution template - c#

We are working asp.net projects where user customizations are released in a new project/solution called as ADDINS (for our comfort). The Structure is soemthign like this:
Solution_ClientName.sln
-> FVAddins //( Website)
->FVAddins_ClientCode_BL.csproj //(class library project)
-> SqlDbProject //(Sql Database project)
I want to know is there any way in Visual Studio , so that I can create a generic template of the same. And whenever , I have to create a new solution, I just need to fill the dynamic parts like ClientName and ClientCode and the directory structure will be ready.
Kindly note,
I do not require it using Programatically. As here's a time constraint. But programmatic approach is welcome too. I will look into that too.
Just To Help
I want it like Microsoft word template file where we have template something like <SomeField> and its get replaced by your desired text, in all over the file.

You could use a config file to this effect, all you would need to do is specify each dynamic part in the config file and load that into the solution on start-up.
Then you have a copy of the same config with different values for each copy of the template you create

Related

Copy/clone an entire WPF solution& project and use it under another name

I have a WPF solution & project(written in Visual Studio2019) that I would like to use under another name.
On the other words, I have a project like( EXAMPLE_A ) that I would like to use on my other task (not creating again the entire project) just copy & paste and rename it (EXAMPLE_B) and then I want to exchange the GUI colors and title and logos...
I tried this copy&paste way but some part of code was wrong: VS said some part of code are not included in this project and so on . However, I copied the entire folder. I saw the Save As is not option... Therefore, I ask your help what is the correct process.
The question: have a simple correct way to clone/ copy the solution and use it under another separated name? ( final outcome: have EXAMPLE_A and EXAMPLE_B separately with same program functions, different name and logo)
Thank you for you all support.
Export your project as a Template in Visual Studio, then you can create another project and change the name or whatever else you need.

Compare Xamarin.Android CPL localization techniques (.xml .po .mo .resx .xlf)

I have inherited an Xamarin Crossplatform project, (Android only,) that had a 'strings.xml' file with some button-names in it.
Need to find a way to add more languages easily and convert code-strings to translatable too (>300+), not just component-Texts.
I've tried many things so far, but nothing worked as expected: [*]
( Most of the examples and help are for Xamarin.Forms only. )
1.) installed ResX manager
it did not recognized my XML files
created .resx files manually, but those have nothing to do with existing xml-translations
could not get back those texts from C# code I've inserted at the manager window
2.) created a second strings.xml >> placed into values-hu folder >> copied XML content >> translated inside the XML.
It works only for buttons in the IDE placed into the activity
can NOT get text with GetText(...,...) from my C# code because it needs an (int)...I don't know how to generate and pair with my own constants
Resources.Strings... does not pop up any of my own string either
whenever I try to add a new element at the IDE,
I have to search and copy manually the new lines to each XML one by one
there is no "translator window" for them like ResX
can not group strings inside the XML file
3.) installed Multilingual App Toolkit 4.0
seems to be just a different file format than .resx, but same problems
complained about not connected to Azure
offered me a "new english" translation from my original english XML
could not add NEW lines, etc.
4.) installed POEdit + Nuget>GetText
at first sight this seemed to be the perfect solution, but
PoEdit has found only 4 strings in my .cs files
( preferences' I/O strings with GetText() method to read from my config.xml )
could not import string.xml files to translate for 3. lang.
do not understand the .po > .mo conversion concept
installed the nuGet GetText > but no new sub-menu appeared anywhere inside VS.
5.) upgraded to VS2017
6.) asked on a local forum, but nobody answered.
7.) Searched through ca 100 topics here >> ... most of them are about Xamarin Forms ... but those seems to be invalid for droid.
[*] by expected I've imagined having a simple wizard where I can:
go through each string in my *.cs files, where I can give a constant name and it's converting "Really Exit" > to: _tr(Res.Main.really_exit)
or mark to skip
should have a manager to easy translate (like ResX), or ADD new lines!
having both component-texts and code-string inside ONE(/ language?) file
possibly group strings by activity / logic. (So translators can see where is what)
... but nothing seems to be able to handle strings.xml files and .cs file-string all in one easily.
So... Now I am totally confused. I've spent a whole week to see some kind of "order" in this chaos, but could not find a proper writing that explains, WHAT METHOD should someone use to do things easily for droid translation and why? Thank you!
I would go with your second approach because it uses the Android build-in localization system. A benefit of using it is that it already has a fallback-solution included, if a language or a key for one language could not be found.
You can use it in your layout files:
<Button
android:text="#string/LogOn_Login"
or inside code:
var progressDialog = new ProgressDialog(this);
progressDialog.Indeterminate = true;
progressDialog.SetCancelable(false);
progressDialog.SetMessage(GetString(Resource.String.LogOn_ProgressMessage));
But you need to know the difference between an Activity and a Fragment.
In an Activity you just need to call GetString(). Which requires an int, that you get from Resource.String.YOUR_KEY. But in a Fragment you have to give the context. The call changes to Activity.GetString().
New languages or strings can easily added. I usually add new string to the strings.xml inside values-folder first. That way I make sure I have the fallback ready. A new string has the following semantics:
<string name="KEY">VALUE</string>
Filled with real data:
<string name="LogOn_ProgressMessage">Authenticating...</string>
After saving the strings.xml file, it turns out to be good to rebuild the project to make sure the Resource.designer.cs is updated. I sometimes saw the behavior that otherwise my newly added keys where not accessible with Resource.Strings.
When it comes to editing the strings.xml, I am with you that there is no "translator window" and that you have to copy each new key to all supported languages. To overcome this issue we build us a tool that creates all those files for use on every build. This way we support a quite large app with more than 21 languages.
With Xamarin I would go down the .Resx files route. string.xml files are an Android solution and don't fit very well into the .NET world.
How to localize your code is nicely explained here:
https://developer.xamarin.com/guides/xamarin-forms/advanced/localization/
And with Reshaper you can extract all the strings from your code:
https://www.jetbrains.com/resharper/features/internationalization.html
Yes, you will have to convert your XML files. In what format are they? You might be able to use this tool:
http://converter.webtranslateit.com/
To use .NET Resource files inside your Library, you have to add the resources to your project first and configure them like below:
Now you can use them for example like this:
BillManagement.ResourceManager.GetString("TaxSetupWrong")
Or
LibraryName.Resources.BillManagement.TaxSetupWrong

Creating File Extensions for my application

I'm wondering how I can create my own file extension to work with my application. For example, say I wanted to have a ".abc" extension. The full file name example would be "MyFile.abc".
I want the file to behave in a way that when it is double clicked, it will open up in my application, but actually it contains data of a .xml file.
Sorry if this makes little sense, this is completely new to me. I'm using c# in visual studio 2013, and basically my application is an automatic update installer. I want it so when my file with my own extension is selected, my application opens and uses the xml data from it to do the update.
You can create your own files with custom extensions by saving the file with that particular extension. Then what you need is to associate the extension with your application. For this you need to create the instance of FileAssociationInfo .
Check this out System-File-Association

How to publish config files along with application in windows forms application

I have a very simple use case.
1) I have 4 config files which are needed for the application to start.
When I publish my application these files should be exported by default along with it. How can I do this ? Where should the files be stored so that they are available when the pplication is installed?
The users of this application should be able to edit and access these files.
I have seen the option of saving it using string source = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
I have tried adding these as resources, but these files need to be editable, hence cannot be in exe.(Reference is this question)
Please comment if you need additional information.
If you're building the installer in Visual Studio, you can add those files as Content and it should be automatically included in the installer when it's built.
You create installers in Visual Studio by adding a Setup Project to the solution.
Link to tutorial on MSDN: http://msdn.microsoft.com/en-us/library/vstudio/19x10e5c(v=vs.100).aspx
I recall it should automatically add all Content items automatically, but I'm a bit rusty. Here's more detail on how to add items to your installer, including desktop shortcuts and such:
http://msdn.microsoft.com/en-us/library/vstudio/z11b431t(v=vs.100).aspx
Good luck!
There are meny ways to do whay you want to do. the main question is why do you want to do it?
if you have a normal program for personal use you can simply link it to the needed file, meaning using the file without actual knowledge that it's there.
if it's for a task then you can zip them together, that way you'll know they are together, without adding them as resource.
for other kind of use, or if you have to add them as resources, just add them like shown here
for more reading on what do you need and how to do it i have here linked vs. Embeded resources
good luck

Windows forms application localization problem?

I have a windows form application. It has textboxs, checkboxs, labels and devxpress xtragrids etc. I need to apply localization to my application. I searched the net and came over some solutions about .resx . But its taking time to apply this method and if i need more languages in the future i need to create a new resx than customize that resx for that form.
Is there any other way to create a xml file so that i or translator change only the xml files.
Regards.
Resx files are in XML to begin with. You don't need to "add more resx" when you add language, at least you do not have to add them to your solution/project. What you need is to apply proper build process (I suspect that you build your application directly from Visual Studio, which is not very good idea) - you could use MSBuild to do that. In that case, all you need to do is to place translated files in their right paths and start building.
There are also other localization methods for Winforms applications - for example you might want to try WinRes.

Categories

Resources