Only output NuGet project element if packages were listed by the project

This commit is contained in:
Jason Perkins 2016-04-13 18:55:44 -04:00
parent 9aa3cf7e96
commit 10b83b950f
2 changed files with 21 additions and 8 deletions

View File

@ -1434,16 +1434,18 @@
function m.ensureNuGetPackageBuildImports(prj)
p.push('<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">')
p.push('<PropertyGroup>')
p.x('<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>')
p.pop('</PropertyGroup>')
if #prj.nuget > 0 then
p.push('<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">')
p.push('<PropertyGroup>')
p.x('<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>')
p.pop('</PropertyGroup>')
for i = 1, #prj.nuget do
local targetsFile = nuGetTargetsFile(prj, prj.nuget[i])
p.x('<Error Condition="!Exists(\'%s\')" Text="$([System.String]::Format(\'$(ErrorText)\', \'%s\'))" />', targetsFile, targetsFile)
for i = 1, #prj.nuget do
local targetsFile = nuGetTargetsFile(prj, prj.nuget[i])
p.x('<Error Condition="!Exists(\'%s\')" Text="$([System.String]::Format(\'$(ErrorText)\', \'%s\'))" />', targetsFile, targetsFile)
end
p.pop('</Target>')
end
p.pop('</Target>')
end

View File

@ -26,6 +26,17 @@
end
--
-- Should not output anything if no packages have been set.
--
function suite.noOutputIfNoPackages()
prepare()
test.isemptycapture()
end
--
-- Writes the pre-build check that makes sure that all packages are installed.
--