質問

I wish to copy MyDir (in my $ProjectDir) to $OutDir{ProductVersion} upon completion of a build.

Using the following configuration in csproj file I am able to get the File Version.

<Target Name="AfterBuild">
    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
      <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
    </GetAssemblyIdentity>
    <Exec Command="robocopy $(ProjectDir)MyDir $(OutDir)/%(AssemblyVersion.Version) /E" IgnoreExitCode="true" />
</Target>

This however, retrieves the FileVersion and not the ProductVersion. Is there any way I can obtain the ProductVersion in post build event?

役に立ちましたか?

解決

You're looking for Read AssemblyFileVersion from AssemblyInfo post-compile. You're going to need a custom task for this, since GetAssemblyIdentity doesn't return the productversion.

The linked question has the answer for AssemblyFileVersion, it shouldn't be too hard to adapt it to make it return the ProductVersion.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top