Last active
April 3, 2016 02:13
-
-
Save tmori3y2/31a820a0829d05377e0b to your computer and use it in GitHub Desktop.
Automatic imported MSBuild target file which imports another one installed at the same time by NuGet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- NuGet Package Manager inserts MSBuildTasks.ImportTasks.targets below Microsoft.CSharp.targets | |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |
<Import Project="..\..\packages\MSBuildTasks.ImportTasks.x.x.x.x\build\MSBuildTasks.ImportTasks.targets" Condition="Exists('..\..\packages\MSBuildTasks.ImportTasks.x.x.x.x\build\MSBuildTasks.ImportTasks.targets')" /> | |
--> | |
<ItemGroup > | |
<PreviousNuPkgFile Include="$(ProjectDir)$(OutDir)*.nupkg" /> | |
<NuSpecFile Include="$(ProjectDir)*.nuspec" /> | |
</ItemGroup> | |
<Target Name="CleanNuPkgFile" | |
BeforeTargets="BeforeClean;BeforeBuild" | |
Condition=" '$(CreatesNuGetPackage)' == 'true' and '@(PreviousNuPkgFile)' != '' "> | |
<Delete Files="@(PreviousNuPkgFile)"/> | |
</Target> | |
<Target Name="NuSpecProject" | |
BeforeTargets="BeforeBuild" | |
Condition=" '$(CreatesNuGetPackage)' == 'true' and '@(NuSpecFile)' == '' "> | |
<Exec WorkingDirectory="$(ProjectDir)" | |
Command=""$(NuGetExe)" spec" /> | |
<Error Text="Add .nuspec file to the project and edit it." /> | |
</Target> | |
<Target Name="NuGetPack" | |
AfterTargets="AfterBuild" | |
Condition=" '$(CreatesNuGetPackage)' == 'true' and '@(NuSpecFile)' != '' "> | |
<CallTarget Targets="NuGetPackProject" | |
Condition=" '$(NuGetPacksProject)' == 'true' and '$(NuGetPacksForTool)' == 'false' " /> | |
<CallTarget Targets="NuGetPackTool" | |
Condition=" '$(NuGetPacksProject)' == 'true' and '$(NuGetPacksForTool)' == 'true' " /> | |
<CallTarget Targets="NuGetPackNuSpec" | |
Condition=" '$(NuGetPacksProject)' == 'false' " /> | |
</Target> | |
<Target Name="NuGetPackProject"> | |
<Exec WorkingDirectory="$(ProjectDir)" | |
Command=""$(NuGetExe)" pack -Prop Configuration=$(Configuration) -OutputDirectory "bin\$(Configuration)"" /> | |
</Target> | |
<Target Name="NuGetPackTool"> | |
<Exec WorkingDirectory="$(ProjectDir)" | |
Command=""$(NuGetExe)" pack -Tool -Prop Configuration=$(Configuration) -OutputDirectory "bin\$(Configuration)"" /> | |
</Target> | |
<Target Name="NuGetPackNuSpec"> | |
<Exec WorkingDirectory="$(ProjectDir)" | |
Command=""$(NuGetExe)" pack $(ProjectName).nuspec -Prop Configuration=$(Configuration) -OutputDirectory "bin\$(Configuration)"" /> | |
</Target> | |
<Target Name="DeployNuPkgFile" | |
AfterTargets="NuGetPack" | |
Condition=" '$(CreatesNuGetPackage)' == 'true' and '$(Configuration)' == 'Release' "> | |
<ItemGroup > | |
<DeployingNuPkgFile Include="$(OutDir)*.nupkg" /> | |
</ItemGroup> | |
<Error Condition=" '@(DeployingNuPkgFile)' == '' " | |
Text="Build .nuspec file correctly." /> | |
<Error Condition=" '@(DeployingNuPkgFile)' != '' and Exists('$(NuGetDeploy)\%(DeployingNuPkgFile.Filename)%(DeployingNuPkgFile.Extension)') " | |
Text="Update .nuspec file version." /> | |
<Copy Condition=" '@(DeployingNuPkgFile)' != '' " | |
SourceFiles="@(DeployingNuPkgFile)" | |
DestinationFiles="@(DeployingNuPkgFile->'$(NuGetDeploy)\%(Filename)%(Extension)')" /> | |
</Target> | |
<Import Project="$(ImportedTask).targets" Condition="Exists('$(ImportedTask).targets')"/> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/tmori3y2/BlogSamples/blob/Article_20160321/NuGetPackages/MSBuildTasks/MSBuildTasks.ImportTasks/nupkg/build/MSBuildTasks.ImportTasks.targets