46
46
<GetAssemblyIdentity AssemblyFiles =" $(PackageDir)\Griddly.Core\lib\net45\Griddly.Mvc.dll" >
47
47
<Output TaskParameter =" Assemblies" ItemName =" AsmInfo" />
48
48
</GetAssemblyIdentity >
49
+ <GetAssemblyInformationalVersion AssemblyFile =" $(PackageDir)\Griddly.Core\lib\net45\Griddly.Mvc.dll" >
50
+ <Output TaskParameter =" Value" ItemName =" AssemblyVersion" />
51
+ </GetAssemblyInformationalVersion >
52
+ <PropertyGroup >
53
+ <AssemblyVersion Condition =" @(AssemblyVersion) != ''" >@(AssemblyVersion)</AssemblyVersion >
54
+ <AssemblyVersion Condition =" $(AssemblyVersion) == ''" >%(AsmInfo.Version)</AssemblyVersion >
55
+ </PropertyGroup >
49
56
50
57
<!-- insert the version number into the nuspec files -->
51
58
<XmlUpdate
52
59
Namespace =" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
53
60
XmlFileName =" $(PackageDir)\Griddly\Griddly.nuspec"
54
61
XPath =" /package/metadata/version"
55
- Value =" %(AsmInfo.Version )" />
62
+ Value =" $(AssemblyVersion )" />
56
63
<XmlUpdate
57
64
Namespace =" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
58
65
XmlFileName =" $(PackageDir)\Griddly.Core\Griddly.Core.nuspec"
59
66
XPath =" /package/metadata/version"
60
- Value =" %(AsmInfo.Version )" />
67
+ Value =" $(AssemblyVersion )" />
61
68
62
69
<XmlUpdate
63
70
Namespace =" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
64
71
XmlFileName =" $(PackageDir)\Griddly\Griddly.nuspec"
65
72
XPath =" /package/metadata/dependencies/group/dependency[@id='Griddly.Core']/@version"
66
- Value =" %(AsmInfo.Version )" />
73
+ Value =" $(AssemblyVersion )" />
67
74
68
75
<Exec WorkingDirectory =" $(PackageDir)"
69
76
Command =" $(BaseDir)\.nuget\nuget.exe pack $(PackageDir)\Griddly\Griddly.nuspec" />
76
83
77
84
<Copy SourceFiles =" @(OutputPackages)" DestinationFolder =" $(PackageDir)" />
78
85
</Target >
86
+
87
+ <UsingTask TaskName =" GetAssemblyInformationalVersion" TaskFactory =" CodeTaskFactory"
88
+ AssemblyFile =" $(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
89
+ <ParameterGroup >
90
+ <AssemblyFile ParameterType =" System.String" Required =" true" />
91
+ <Value ParameterType =" System.String" Output =" true" />
92
+ </ParameterGroup >
93
+ <Task >
94
+ <Reference Include =" System.Core" />
95
+ <Using Namespace =" System" />
96
+ <Using Namespace =" System.IO" />
97
+ <Using Namespace =" System.Diagnostics" />
98
+ <Using Namespace =" System.Reflection" />
99
+ <Code Type =" Fragment" Language =" cs" >
100
+ <![CDATA[
101
+ var attr = Attribute.GetCustomAttribute(Assembly.LoadFile(Path.GetFullPath(AssemblyFile)), typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;
102
+
103
+ Value = attr != null ? attr.InformationalVersion : null;
104
+ ]]>
105
+ </Code >
106
+ </Task >
107
+ </UsingTask >
79
108
</Project >
0 commit comments