Hi again,
> How can I set a property in such an MSBuild project? Can the value of a
> property come from an external tool that e.g. runs across the working
> copy to determine the SVN revision number?
Absolutely, in our case CruiseControl.NET is passing $(CCNetLabel) to
CIBuildNumber, so we do something like:
msbuild.exe Framework.sln /p:CIBuildNumber=$(CCNetLabel) ...
> Does this task affect the file being compiled or will I again have to
> set that "don't use host compiler" flag on the csproj file?
If you make the change in the BeforeBuild target, it updates the file
before compilation, which is normally always what you want, but if
not, use AfterBuild target.
One other thing about the MSBuild UpdateVersion task that you may find
useful, I coded it so that if you don't specify an output property to
write, it just loads up the properties of the task ready for use,
without overwriting the assembly info file. I forgot to mention the
task also has a Version property which is the concatenation of
Major.Minor.BuildNumber.Revision.
For example, here's part of an MSBuild script, again called from
BeforeBuild target, but this time it's for our WiX project which is
built after the Framework assemblies are compiled.
<Target Name="UpdateFrameworkProductVersion">
<UpdateVersion Attribute="AssemblyFileVersion"
AssemblyInfo="..\Framework\Properties\FrameworkAssemblyInfo.cs">
<Output TaskParameter="Version" PropertyName="AssemblyFileVersion" />
</UpdateVersion>
<FileUpdate Files="Config.wxi" Regex="define ProductVersion =
"(\d{1,5}\.){3}\d{1,5}"" ReplacementText="define
ProductVersion = "$(AssemblyFileVersion)"" />
</Target>
So the UpdateVersion is similar, except no BuildNumber output property
specified and an AssemblyFileVersion property is created. You could
create 4 properties for each version part and then concatenate in
MSBuild, but I'm lazy :)
The FileUpdate task is part of "MSBuild Community Tasks" and just does
some regex find and replace on a wix config file looking for the MSI
product version variable, and automatically sets it based upon our
framework AssemblyFileInfo version.
Not sure if we're getting too far off the svn path here, but if you
have further questions (sorry I can't give you the UpdateVersion code)
I'd recommend asking on StackOverflow.com, or hit me off list.
Regards,
Si
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2389683
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-09-01 09:40:48 CEST