Changing AssemblyInfoTask properties for a single csproj?

I'd like to be able to fix the AssemblyVersion differently for different projects on my dev-machine. Let's say I have ApplicationA with version 1.0.0.0 and ApplicationB with version 1.3.0.0.

To get this to work I assume that I could use a PropertyGroup in the csproj file for these two applications (as they reside in different solutions).

So basically I'd like to add the following to the csproj file for ApplicationB:

<PropertyGroup>
<AssemblyMajorVersion>1</AssemblyMajorVersion>
<AssemblyMinorVersion>3</AssemblyMajorVersion>
</PropertyGroup>

However, doing so does not lead to the desired behaviour - AssemblyInfoTask seems to just ignore these settings.

So how can i specify properties for AssemblyInfoTask in the csproj file

regards,

MBorn



Answer this question

Changing AssemblyInfoTask properties for a single csproj?

  • mickers

    I apologize for being dense, but when I put this code in my vcproj file, devstudio complains that AssemblyMajorVersion is an invalid child element. What am i doing wrong
    <Import Project="$(MSBuildExtensionsPath)\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets"/>
    <PropertyGroup>
    <AssemblyMajorVersion>8</AssemblyMajorVersion>
    <AssemblyFileMajorVersion>8</AssemblyFileMajorVersion>
    </PropertyGroup>
    Thanks, Pete

  • Ben Fidge

    That's exactly what you want to do, however you need to make sure that property group appears after the line that imports Microsoft.VersionNumber.Targets.

    Hope that helps,

    Neil



  • SAMI_12

    I apologize for being dense, but I am obviously missing something. when I put the following lines in my vcproj file, devstudio says that AssemblyMajorVersion is an invalid child element. What have I done wrong

    <Import Project="$(MSBuildExtensionsPath)\Microsoft\AssemblyInfoTask\Microsoft.VersionNumber.Targets"/>
    <PropertyGroup>
    <AssemblyMajorVersion>8</AssemblyMajorVersion>
    <AssemblyFileMajorVersion>8</AssemblyFileMajorVersion>
    </PropertyGroup>


    Thanks, Pete

  • RON 7659

    Ignore the warning. It's using the official MSBuild schema, which doesn't know about AssemblyMajorVersion/AssemblyFileMajorVersion. It's just a schema warning; the project should build fine.

    Neil



  • Changing AssemblyInfoTask properties for a single csproj?