How to use Svn Version task to install vb project version

I have a Visual Studio 2008 solution where the exe's main output is VB.Net Winforms exe, which has multiple VB.Net and C # dlls related to the same solution. The entire solution is under subversion version control.

Now I want to automatically update the generated files with the current svn version number. For this I found this neat project: http://svnversiontasks.codeplex.com/ You also need the MSBuild.Communuity.Tasks program for this.

There was a msbuild example on how to update the rev number for each individual project in your solution that I am using:

  <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 include the AssemblyInfo.vb file as well, and saved it as msbuild.proj file.

However, if I run 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 the same:

  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.

      

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

+2


a source to share


1 answer


If you look in the source code of the UpdateVersion task, you should use Regex to parse the AssemblyInfo file, so it shouldn't be surprising if it doesn't work with the vb file.

You can do what you want only using MSBuild.Community.Tasks:



  • SvnVersion to get the version (you can also use the SvnGetProperty task from SvnVersionTasks)
  • AssemblyInfo to generate assembly information with the correct version. These tasks are handled by VB.
0


a source







All Articles