I would like to put the date the application was built somewhere in the application. Say the about box. Any ideas how this can be done? I need to do this for C# but I am also looking for a general idea, so you can answer this for any specific language other than C#.
Typically we just go with the executable's last modify date. This will be set when the exe is built and usually never changes (short of someone actually editing the file). When the file is installed, copied, moved, etc, Windows doesn't change that value.
DateTime buildDate =
new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
We use this technique for the about dialogs in our C# and C++ apps.
The third number of the assembly version is a julian date with 0=1 Jan 2000 if you're using [assembly: AssemblyVersion("1.0.*")]
e.g.
DateTime buildDate = new DateTime(2000,1,1).AddDays(
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build
);
You should be using version control - Subversion is free. Then you could include a number from the version control system that would unambiguously identify the source code used to build the app. A date won't do that. There are other advantages too.
Full history of all changes to the project.
Work seamlessly with other developers on the same project.
EDIT: Nikhil is already doing all this. But for some incomprehensible reason he has been told to include the date as well. I'm going to leave this answer here anyway, for future readers of this question.
There are usually keywords in your source code control system for this sort of thing.
Otherwise, look at including the date and time in the version number, or simply creating a small source code file which contains the date and time, and gets included in the build
Related
As far as I know there are two ways to tag a build:
increment AssemblyInfo.cs version and commit the change
add a version control label
What are pros and cons of these two approaches?
Thanks.
I would prefer to use "Label" since it is more easy to achieve. TFS already supports to label the source code after the build and when you want to get that specific version, you just need to use the label directly. But with assembly version, you need to do more things to increase the version and check in the change. And you need to find the id for that changeset first and then get that version when you want to get it. And also, "label" does not affect the history of source code while "assembly version" will create lots of history if the version increments frequently.
Just as Daniel commented, they are not analogous and Contrary in TFS. It depends which one more suitable for your situation.
AssemblyInfo.cs controls the assembly version for the compiled application.
Version control Labels let you take a snapshot of your files so that at a later date you can refer back to that snapshot. By using your label, you can view, build, or even roll back a large set of files to the state they were in when you applied the label.
More details please refer this link from MSDN: Use labels to take a snapshot of your files
My boss set our IDEs up to use non-standard formatting. For example, it adds spaces between the parenthesis and parameters. This is fine for the new stuff that we've started from scratch, but it's super annoying when I go into existing projects and try to format the code with Ctrl-k-d because when I go to compare the file with the latest version before checking in my changes it looks like I've changed almost every single line in the file and it's difficult to pick out the actual changes.
I would like to be able to use his settings in the newer development, but switch to the default settings when working with other projects. Is there a way to accomplish this without having to go into the settings and uncheck/recheck all the appropriate options every time?
EDIT: I understand it might be good to reformat all legacy code to use the new standards. Unfortunately, that's not my decision to make. And even so, I sometimes work from my personal computer which I also use on occasion to do contract work for other companies. I obviously can't reformat their code to fit my bosses standards.
You can easily switch between settings, by creating separate .settings files and using a VSIX package to switch between them by loading them into Visual Studio - I use this for switching between Dual and Single monitor settings via menu items in the Tools menu.
Using an extension is annoyingly complex for such a simple operation, and this was a whole lot easier when Visual Studio supported macros. However I've uploaded my homebrew extension to GitHub in case you want to have a look.
The tricky bit is editing the settings files to only contain the ones you're interested in, which I expect are the ones in Text Editor\C#\Formatting\Spacing.
The Rebracer extension stores code formatting options alongside each solution and when you open a solution, Rebracer will automatically apply that solution's settings.
I have a software developed in C#, which is a pure sentefic application. Howver the German users found this software stopped working from time to time, when it is installed on German computers. The temporary solution is to change the Language setting in the control panel, and it works fine after we change the language setting from German to English. This is just a kind of engineering sofware, and the software have nothing relalted to the German or English language. Also, as suggested from other posts in msdn, I have checked the "InitializeComponent()" in the source does several times. There are not strange codes in the "InitializeComponent()" function.
When you change locale, you change the meaning of ',' (comma) and '.' (full-stop) when used in numbers. Could it be that you are trying to parse text containing these characters into numbers?
Does your program attempt to initialize numeric fields with formatted numbers, perhaps?
You need to make sure that your code is sensitive to the user's culture when parsing and formatting text. You also need to make sure you use a consistent culture (e.g. the InvariantCulture) when reading data stored to file or sent over a network.
If you are using .NET Framework 4.5, you might be interested to read about the CultureInfo.DefaultThreadCurrentCulture Property.
In the .NET Framework 4 and previous versions, by default, the culture
of all threads is set to the Windows system culture. For applications
whose current culture differs from the default system culture, this
behavior is often undesirable.
The examples and their explanations on the page could be quite helpful for your issue.
Also, as a side note, try{...}catch{...} blocks are always welcome.
I was wondering if there is another way to spell check a Windows app instead what I've been of using: "Microsoft.Office.Interop.Word". I can't buy a spell checking add-on. I also cannot use open source and would like the spell check to be dynamic..any suggestions?
EDIT:
I have seen several similar questions, the problem is they all suggest using open source applications (which I would love) or Microsoft Word.
I am currently using Word to spell check and it slows my current application down and causes several glitches in my application. Word is not a clean solution so I'm really wanting to find some other way.. Is my only other option to recreate my app as a WPF app so I can take advantage of the SpellCheck Class?
If I were you I would download the data from the English Wiktionary and parse it to obtain a list of all English words (for instance). Then you could rather easily write at least a primitive spell-checker yourself. In fact, I use a parsed version of the English Wiktionary in my own mathematical application AlgoSim. If you'd like, I could send you the data file.
Update
I have now published a parsed word list at english.zip (942 kB, 383735 entries, zip). The data originates from the English Wiktionary, and as such, is licensed under the Creative Commons Attribution/Share-Alike License.
To obtain a list like this, you can either download all articles on Wiktionary as a huge XML file containing all Wiki- and HTML-formatted articles. This is then more or less trivial to parse. Alternatively, you can run a bot on the site. I got help to obtain a parsed file from a user at Wiktionary (I seem to have forgotten his name, though...), and this file (english.txt in english.zip) is a further processed version of the file I got.
http://msdn.microsoft.com/en-us/library/system.windows.controls.spellcheck.aspx
I use Aspell-win32, it's old but it's open source, and works as well or better than the Word spell check. Came here looking for a built in solution.
I am working with another colleague in C# in VS2005 in a not very complex project. However, we have no version control system, we send each other our last version and copy the changes into our own files.
We now have to merge both files (most of the project is a single form file) into a last version of the project.
Any suggestions? Maybe trying diff tools? It must be done quickly and probably learning how to use complex revision control programs is not doable.
I'll spare you the lecture on not using version control, but your best bet is to try and use a differencing tool like WinMerge to compare the differences of the 2 files and manually merge the changes that each of you has made into a single file.
If you have the common file that you both started with before you each made any changes, then you can use a 3-way merge feature to generate a file that has both of your changes in it.
It was pointed out to me that WinMerge does not offer a 3-way merge, so refer to this other question for finding a tool that supports it.
We use BeyondCompare - we have found that to be an excellent compare and merge tool.
I understand the need for speed to produce your final version of the code now.
However, if you are planning to start another project it really is worth investing the time to set up a source control system. You'll save that time in spades over the course of the project!
Try SourceGear DiffMerge. Some members of my team even use it instead of the standard compare/merge tool from Visual Studio.
I think WinMerge is great for diffing and merging files.
However, I would definitely recommend that you get yourself some kind of source control system. CVS, Subversion, Git, Mercurial, whatever!!! It doesn't really matter which you choose, just get one. You will almost immediately get return on that investment in time, and you will also learn about something that is crucial in all serious software development.
Try WinMerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Because I just found this question while looking for something completely different, and noticed the assertion that WinMerge doesn't do 3-way merge.
This used to be true, but WinMerge is under new management, and has had 3-way merge for some time now. At the time of this post, the current WinMerge version is 2.16.2, available at WinMerge.Org (setup kits for 32 and 64 bit, as well as source code).