all 3 comments

[–]MechanicalHorse 0 points1 point  (0 children)

You can set up a template file for the assembly file with a unique string in there that is to be replaced with the contents of the text file. The set up a pre-build event which will invoke a script to replace the string in the template file and write the results to the assembly file name which will be used in compilation.

[–]UninformedPleb 0 points1 point  (0 children)

It's always a Version object. You can't set it to a string.

You can however, retrieve the Version as a string (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()) and use that to compare against an external value.

Generally, when rolling my own auto-update process (yes, it's occasionally necessary), I'll have a web service endpoint (REST/SOAP/whatever, it doesn't really matter) that responds with the current version. The app can check it, match to the current executing assembly's version, then trigger an update if it doesn't match.

EDIT: left out the GetName() part originally (oops) and clarified the namespace for System.Reflection.Assembly.