View Full Version : Setting AssemblyKeyFileAttribute property in assemblyinfo.vb
jfreedman
10-15-2004, 11:13 AM
Hi there,
Currently Evaluating Visual Build and I'm trying to figure out a few things. In general what do people think of this product?
Main question...
When I add a Make VS.NET action, under the properties tab I can modify several assemblyinfo properties, but I don't seem to have access to the "AssemblyKeyFileAttribute" property.
When our build happens, I would like to make sure this property is always set, so our object will be strong named. Is there anyway to do this in Visual Build Pro?
Thanks!
kevina
10-15-2004, 01:24 PM
No direct way currently exists in Visual Build Professional to update that particular entry in the AssemblyInfo property from a Make VS.Net action.
You can fairly easily modify the AssemblyInfo file directly using a Replace In File step and a Write File step, see the attached example that demonstrates this.
pjaquiery
10-17-2004, 04:09 PM
In general Visual Build Pro. is an excellent product and the support is the best I have ever seen anywhere!
There are a few traps when you are getting started, particuarly to do with inline script. But the power that you get as compensation is much more than worth the pain.
If you need any sort of build management or similar system then VBP is it.
Peter Jaquiery
jfreedman
10-18-2004, 03:55 PM
Let me rephrase my post I earlier deleted...
I am assuming (based on my tests) that in the replace action, if the item we are searching for to replace already equals what it should replace, I get a message of "No replacements made in file"
The next action which then adds to the file will add the property if the last action returned "No replacements made in file".
So in my instance, if the property is already set correctly, the first action returns "No replacements made in file", the next action then says if the prior action returned "No replacements made in file", then to add text to it. This would cause the property to get written out a second time.
How do I prohibit it being written out on the second action if the first action returned "No replacements made in file" because the property was already there?
Thx
kinook
10-18-2004, 06:00 PM
As you discovered, the test in the above example isn't foolproof because the Replace in File action only modifies the file (and logs such action) if the replacement value(s) would change the file contents. The attached updated sample uses a conditional build rule that checks the file for the existence of that attribute instead.
Also, the next release of VBP will include enhancements to the Replace in File action, including storing temporary macros for the match count and replacement count, allowing the match count to be checked in this situation.
jfreedman
10-19-2004, 08:51 AM
I took a look at the new sample but there don't seem to be any project steps in it. Am I missing something here?
Thx
kinook
10-19-2004, 09:32 AM
Hmmm. Must have been a hiccup in the forum upload. The attachment should be non-empty now.
jfreedman
10-19-2004, 01:24 PM
Another question for ya...
I have setup a Macro variable called VersionNumber, its value is 3.2.3.0
In my replace action, I tell it to replace with the following...
$2%VersionNumber%$4
Which would evaluate to $23.2.3.0$4
It believes I want to replace with a "$23" instead of "$2", since the first char in my variable is a 3
How do I keep this from happening so it evaluates to the $2 only?
Thx again for the help.
kinook
10-19-2004, 01:29 PM
Use $2(%ASSEMBLYKEYFILEATTRIBUTE%)$4
jfreedman
10-19-2004, 02:30 PM
Hello one more time,
I tried running the repl_keyfileattr.bld project. I run all 3 steps the first time, and the assemblyinfo data gets inserted.
If I then run only step 3 again, which should only write out the info if it isn't found, it still writes it out a second time even though the data already exists.
The instr that is defined in the writefile action looks correct, I'm not sure why it is returning a false value and making the action kick off.
Thx
kinook
10-19-2004, 02:51 PM
Possibly this:
http://www.kinook.com/Forum/showthread.php?threadid=228
http://www.kinook.com/Forum/showthread.php?threadid=240
jfreedman
10-19-2004, 03:34 PM
Thanks,
That was it.
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.