Skip to content

Commit

Permalink
getting package version from AssemblyInfo.cs file
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyoder committed Dec 29, 2011
1 parent 392de73 commit d12b66a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 21 deletions.
18 changes: 9 additions & 9 deletions package/LinqToExcel.nuspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>LinqToExcel</id>
<version>1.5.5</version>
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>LinqToExcel</id>
<version>Auto populated from AssemblyInfo.cs file</version>
<authors>Paul Yoder</authors>
<description>Easily retrieve data from spreadsheets and csv files by using LINQ</description>
<description>Easily retrieve data from spreadsheets and csv files by using LINQ</description>
<language>en-US</language>
<licenseUrl>https://github.com/paulyoder/LinqToExcel/blob/master/License.txt</licenseUrl>
<projectUrl>http://code.google.com/p/linqtoexcel/</projectUrl>
<tags>Linq Excel spreadsheet csv</tags>
</metadata>
</package>
<tags>Linq Excel spreadsheet csv</tags>
</metadata>
</package>
47 changes: 38 additions & 9 deletions project.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<property name="tool.nuget" value="${dir.base}\tools\NuGet\nuget.exe" />

<target name="build" depends="clean, compile, compile64, deleteLog4netXml" />
<target name="publish" depends="test, build, zip, zip64, package, package64" />
<target name="publish" depends="test, build, zip, zip64, package, package64, resetNuspecVersion" />

<target name="clean" description="deletes folders used in the build">
<delete dir="${dir.bin}" if="${directory::exists(dir.bin)}" />
Expand All @@ -41,8 +41,29 @@
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="&quot;${file.project}&quot; /p:Configuration=Release;DocumentationFile=LinqToExcel.xml;Platform=x64;OutputPath=&quot;${dir.bin64}\\&quot;" />
</target>

<target name="getPublishVersion" description="Gets the AssemblyVersion and sets it in the nuspec file">
<loadfile
file="${dir.base}\src\LinqToExcel\Properties\AssemblyInfo.cs"
property="assemblyInfoContents" />

<regex
input="${assemblyInfoContents}"
pattern="AssemblyVersion\(&quot;(?'assemblyVersion'[^&quot;]*)&quot;\)" />

<property
name="publish.version"
value="${assemblyVersion}" />
</target>

<target name="setVersion" description="Sets the package version in the nuspec file" depends="getPublishVersion">
<xmlpoke
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
value="${publish.version}" />
</target>

<target name="zip" description="zips the contents of the bin folder to the zip.dir">
<target name="zip" description="zips the contents of the bin folder to the zip.dir" depends="setVersion">
<xmlpeek
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
Expand All @@ -54,30 +75,28 @@
</zip>
</target>

<target name="zip64" description="zips the contents of the bin64 folder to the zip.dir64">
<xmlpeek
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
property="publish.version" />
<target name="zip64" description="zips the contents of the bin64 folder to the zip.dir64" depends="setVersion">
<zip zipfile="${dir.base}\LinqToExcel_x64_${publish.version}.zip">
<fileset basedir="${dir.bin64}">
<include name="**/*" />
</fileset>
</zip>
</target>

<target name="package" description="creates the NuGet package">
<target name="package" description="creates the NuGet package" depends="setVersion">
<copy todir="${dir.package}\lib">
<fileset basedir="${dir.bin}">
<include name="*.dll" />
<include name="LinqToExcel.xml" />
</fileset>
</copy>

<exec program="${tool.nuget}" commandline="pack &quot;${dir.package}\LinqToExcel.nuspec&quot;" />

<delete dir="${dir.package}\lib" />
</target>

<target name="package64" description="creates the NuGet package for the 64bit version">
<target name="package64" description="creates the NuGet package for the 64bit version" depends="setVersion">
<copy todir="${dir.package64}\lib">
<fileset basedir="${dir.bin64}">
<include name="*.dll" />
Expand All @@ -89,15 +108,25 @@
<include name="LinqToExcel.nuspec" />
</fileset>
</copy>

<move file="${dir.package64}/LinqToExcel.nuspec"
tofile="${dir.package64}/LinqToExcel_x64.nuspec" />
<xmlpoke
file="${dir.package64}\LinqToExcel_x64.nuspec"
xpath="package/metadata/id"
value="LinqToExcel_x64" />

<exec program="${tool.nuget}" commandline="pack &quot;${dir.package64}\LinqToExcel_x64.nuspec&quot;" />

<delete dir="${dir.package64}" />
</target>

<target name="resetNuspecVersion">
<xmlpoke
file="${dir.package}\LinqToExcel.nuspec"
xpath="package/metadata/version"
value="Auto populated from AssemblyInfo.cs file" />
</target>

<target name="compile-test-project" description="compiles the test project">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
Expand Down
5 changes: 2 additions & 3 deletions src/LinqToExcel/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.5.0")]
[assembly: AssemblyFileVersion("1.5.5.0")]
[assembly: AssemblyVersion("1.5.5")]
[assembly: AssemblyFileVersion("1.5.5")]

0 comments on commit d12b66a

Please sign in to comment.