Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
Added commands to push to NuGet
Browse files Browse the repository at this point in the history
  • Loading branch information
JSkimming committed Nov 26, 2013
1 parent 605a302 commit 79adb6b
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
11 changes: 11 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo Off
SET config=%1
IF "%config%" == "" (
SET config=Release
)

SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"

call "%~dp0src\RestorePackages.cmd"
echo %msbuild% "%~dp0src\AspNet.Identity.EntityFramework.Multitenant.sln" /nologo /verbosity:m /t:Rebuild /p:Configuration="%config%" /p:VisualStudioVersion=12.0
%msbuild% "%~dp0src\AspNet.Identity.EntityFramework.Multitenant.sln" /nologo /verbosity:m /t:Rebuild /p:Configuration="%config%" /p:VisualStudioVersion=12.0
10 changes: 10 additions & 0 deletions push.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo Off

SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"

if "%1" == "" (
call "%~dp0build.cmd"
)

echo %msbuild% "%~dp0src\BuildTargets\NuGetPush.proj" /nologo /verbosity:m
%msbuild% "%~dp0src\BuildTargets\NuGetPush.proj" /nologo /verbosity:m
14 changes: 14 additions & 0 deletions src/BuildTargets/NuGetPush.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="All"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WorkingDir>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..'))</WorkingDir>
</PropertyGroup>

<Import Project="NuGetPush.targets"/>

<Target Name="All"
DependsOnTargets="PushNuGetPackages"/>

</Project>
73 changes: 73 additions & 0 deletions src/BuildTargets/NuGetPush.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<WorkingDir Condition="'$(WorkingDir)'==''">$([System.IO.Path]::GetFullPath('.'))</WorkingDir>
</PropertyGroup>

<ItemGroup>
<NuGetExePathGroup Condition="'$(NuGetExePath)'==''" Include="$(WorkingDir)\**\NuGet.exe" />
</ItemGroup>

<PropertyGroup>
<NuGetExePath Condition="'$(NuGetExePath)'==''">@(NuGetExePathGroup)</NuGetExePath>
</PropertyGroup>

<!--
Target to test whether the necessary properties have been predefined.
-->
<Target Name="TestNuGetPushProperties">

<!-- Do the error checking to ensure the appropriate items are defined.-->
<Error Condition="'$(WorkingDir)'==''" Text="WorkingDir is not defined."/>
<Error Condition="'$(NuGetExePath)'==''" Text="NuGetExePath is not defined."/>
<Error Condition="!Exists('$(NuGetExePath)')" Text="'$(NuGetExePath)' does not exist."/>

<Message Text="NuGetPush.targets Properties:-" />
<Message Text="WorkingDir: '$(WorkingDir)'" />
<Message Text="NuGetExePath: '$(NuGetExePath)'" />
</Target>

<!--
Gets the list of nuget packages.
-->
<Target Name="GetNuGetPackageFiles">

<CreateItem Include="$(WorkingDir)\**\bin\**\*.nupkg" Exclude="$(WorkingDir)\**\bin\**\*.symbols.nupkg">
<Output TaskParameter="Include" ItemName="NuGetPackageFiles" />
</CreateItem>

<Message Text="Found NuGet Packages:-" Condition="'@(NuGetPackageFiles)' != ''"/>
<Message Text="%(NuGetPackageFiles.FullPath)" />
</Target>

<!--
Push the packages to NuGet.
-->
<Target Name="CoreNuGetPush"
Inputs="%(NuGetPackageFiles.FullPath)"
Outputs="%(NuGetPackageFiles.Filename).xml"
DependsOnTargets="GetNuGetPackageFiles">

<PropertyGroup>
<PushCommand>"$(NuGetExePath)" push "%(NuGetPackageFiles.FullPath)"</PushCommand>
</PropertyGroup>

<!--<Message Text="$(PushCommand)" Importance="High" />-->
<Exec Command="$(PushCommand)" />

</Target>

<!--
Property group to define the dependencies of PushNuGetPackages target
-->
<PropertyGroup>
<PushNuGetPackages>
$(PushNuGetPackages);
TestNuGetPushProperties;
CoreNuGetPush;
</PushNuGetPackages>
</PropertyGroup>
<Target Name="PushNuGetPackages" DependsOnTargets="$(PushNuGetPackages)" />

</Project>
1 change: 1 addition & 0 deletions src/RestorePackages.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"%~dp0.nuget\NuGet.exe" restore "%~dp0AspNet.Identity.EntityFramework.Multitenant.sln"

0 comments on commit 79adb6b

Please sign in to comment.