Dynamic assembly information
-
Hi, Our solution in .net 3.5 has a number of dll's as output. In those dll's we populate some fields like version, company, product etc. But also a copyright notice. For instance, if I have this notice: "Copyright (c) 2011 Initech Inc.". Is it possible to make the year value be determined at compile time? So, if I compile it in 2011, then it says "Copyright (c) 2011 Initech Inc.". If I compile it in 2012, it would say "Copyright (c) 2012 Initech Inc.". I've toyed with some things, but AssemblyCopyright requires a constant as value. Is it possible at all?
The consumer isn't a moron; she is your wife.
-
Hi, Our solution in .net 3.5 has a number of dll's as output. In those dll's we populate some fields like version, company, product etc. But also a copyright notice. For instance, if I have this notice: "Copyright (c) 2011 Initech Inc.". Is it possible to make the year value be determined at compile time? So, if I compile it in 2011, then it says "Copyright (c) 2011 Initech Inc.". If I compile it in 2012, it would say "Copyright (c) 2012 Initech Inc.". I've toyed with some things, but AssemblyCopyright requires a constant as value. Is it possible at all?
The consumer isn't a moron; she is your wife.
This always works for me :) Hope it helps.
StreamReader reader = new StreamReader(@"C:\FilePath\AssemblyInfo.cs");
string contents = reader.ReadToEnd();
reader.Close();string NewCopyrightText = "Yippie. All rights reserved " + DateTime.Now.Year; // replace assembly version string replacement = "\[assembly: AssemblyCompany(\\"" + NewCopyrightText + "\\")\]"; contents = Regex.Replace(contents, @"\\\[assembly: AssemblyCompany\\("".\*""\\)\\\]", replacement); StreamWriter writer = new StreamWriter(@"C:\\FilePath\\AssemblyInfo.cs", false); writer.Write(contents); writer.Close();
-
Hi, Our solution in .net 3.5 has a number of dll's as output. In those dll's we populate some fields like version, company, product etc. But also a copyright notice. For instance, if I have this notice: "Copyright (c) 2011 Initech Inc.". Is it possible to make the year value be determined at compile time? So, if I compile it in 2011, then it says "Copyright (c) 2011 Initech Inc.". If I compile it in 2012, it would say "Copyright (c) 2012 Initech Inc.". I've toyed with some things, but AssemblyCopyright requires a constant as value. Is it possible at all?
The consumer isn't a moron; she is your wife.
Helfdane wrote:
Copyright (c)
That's redundant. "The symbol © (the letter C in a circle), or the word “Copyright,” or the abbreviation “Copr.”;" -- http://www.copyright.gov/circs/circ1.pdf[^]
-
Helfdane wrote:
Copyright (c)
That's redundant. "The symbol © (the letter C in a circle), or the word “Copyright,” or the abbreviation “Copr.”;" -- http://www.copyright.gov/circs/circ1.pdf[^]
Not neccesarily: 'Some countries will not accept the symbol alone, they also require the word Copyright to appear in order to consider the notice valid. Using the word ensures that there can be no confusion.' http://www.copyrightservice.co.uk/copyright/p03_copyright_notices[^]
-
Not neccesarily: 'Some countries will not accept the symbol alone, they also require the word Copyright to appear in order to consider the notice valid. Using the word ensures that there can be no confusion.' http://www.copyrightservice.co.uk/copyright/p03_copyright_notices[^]
Exactly, you only need the word. You use the symbol when there isn't enough room for the word.
-
This always works for me :) Hope it helps.
StreamReader reader = new StreamReader(@"C:\FilePath\AssemblyInfo.cs");
string contents = reader.ReadToEnd();
reader.Close();string NewCopyrightText = "Yippie. All rights reserved " + DateTime.Now.Year; // replace assembly version string replacement = "\[assembly: AssemblyCompany(\\"" + NewCopyrightText + "\\")\]"; contents = Regex.Replace(contents, @"\\\[assembly: AssemblyCompany\\("".\*""\\)\\\]", replacement); StreamWriter writer = new StreamWriter(@"C:\\FilePath\\AssemblyInfo.cs", false); writer.Write(contents); writer.Close();