How to use Svn Version Task to set the Version of a vb project

Posted by SchlaWiener on Stack Overflow See other posts from Stack Overflow or by SchlaWiener
Published on 2010-05-03T10:24:39Z Indexed on 2010/05/03 10:28 UTC
Read the original article Hit count: 428

I have a Visual Studio 2008 Solution where the main output exe is a VB.Net Winforms exe which has several VB.Net and C# dll's linked from the same solution. The whole solution is under version control with subversion.

Now I want to automagically update by generated files with the current svn revision number. For this purpose I found this neat project: http://svnversiontasks.codeplex.com/ You also need the MSBuild.Communuity.Tasks for this to work.

There was a msbuild example on how to update the rev number for every single project in your solution which I use:

  <Import Project="$(MSBuildExtensionsPath)\SvnTools.Targets\SvnTools.Tasks.VersionManagement.Tasks" />
  <Target Name="build">
    <CreateItem Include="../**/AssemblyInfo.vb;../**/AssemblyInfo.cs;../**/Properties/AssemblyInfo.cs">
      <Output TaskParameter="Include" ItemName="AssemblyInfoFiles" />
    </CreateItem>
    <CreateItem Include="../**/*.vdproj;*.vdproj">
      <Output TaskParameter="Include" ItemName="DeploymentProjectFiles" />
    </CreateItem>
    <UpdateVersion AssemblyInfoFiles="@(AssemblyInfoFiles)" DeploymentProjectFiles="@(DeploymentProjectFiles)" Format="yyyy.mm.dd.rev" />
    <Exec Command="&quot;$(VS90COMNTOOLS)..\IDE\devenv&quot; ..\MyApp.sln /build" />
    <RevertVersionChange AssemblyInfoFiles="@(AssemblyInfoFiles)" DeploymentProjectFiles="@(DeploymentProjectFiles)" />
  </Target>

I modified the original file to also include the AssemblyInfo.vb file and saved it as a msbuild.proj file.

However if I execute msbuild from the console I see that the C# projects are updated (I can also confirm that from the properties of the output dll but my vb project remains unchanged:

  Reverting version number change: ../App1\AssemblyInfo.vb
  Updating version number (to rev 0) for file: ../App1\AssemblyInfo.vb
D:\Source\MyApp\MyAppDeploy\MyAppDeploy.csproj : warning : Version attribute not found, file not updated.

  Reverting version number change: ../App2\Properties\AssemblyInfo.cs
  Updating version number (to rev 0) for file: ../App2\Properties\AssemblyInfo.cs
  Successfully updated file.

Maybe the task does not support VB.Net. But maybe someone has a solution for this...

© Stack Overflow or respective owner

Related posts about svn

Related posts about svnversiontask