Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<ContentTargetFolders Condition="'$(ContentTargetFolders)' == ''">content;contentFiles</ContentTargetFolders>
<PackDependsOn>$(BeforePack); _IntermediatePack; GenerateNuspec; $(PackDependsOn)</PackDependsOn>
<IsInnerBuild Condition="'$(TargetFramework)' != '' AND '$(TargetFrameworks)' != ''">true</IsInnerBuild>
<NoBuild Condition="'$(GeneratePackageOnBuild)' == 'true'">true</NoBuild>
<SymbolPackageFormat Condition="'$(SymbolPackageFormat)' == ''">symbols.nupkg</SymbolPackageFormat>
<AddPriFileDependsOn Condition="'$(MicrosoftPortableCurrentVersionPropsHasBeenImported)' == 'true'">DeterminePortableBuildCapabilities</AddPriFileDependsOn>
<NuspecOutputPath Condition="'$(NuspecOutputPath)' == ''">$(BaseIntermediateOutputPath)$(Configuration)\</NuspecOutputPath>
Expand All @@ -49,10 +48,10 @@ Copyright (c) .NET Foundation. All rights reserved.
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder Condition="'$(SymbolPackageFormat)' == 'snupkg'">.pdb</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>
<SuppressDependenciesWhenPacking Condition="'$(SuppressDependenciesWhenPacking)' == ''">false</SuppressDependenciesWhenPacking>
</PropertyGroup>
<PropertyGroup Condition="'$(NoBuild)' == 'true' ">
<PropertyGroup Condition="'$(NoBuild)' == 'true' or '$(GeneratePackageOnBuild)' == 'true'">
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>
<PropertyGroup Condition="'$(NoBuild)' != 'true' ">
<PropertyGroup Condition="'$(NoBuild)' != 'true' and '$(GeneratePackageOnBuild)' != 'true'">
<GenerateNuspecDependsOn>Build;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3941,5 +3941,30 @@ public void PackCommand_PackProject_PacksFrameworkReferences_FrameworkReferences
}
}
}

[PlatformFact(Platform.Windows)]
public void PackCommand_WithGeneratePackageOnBuildSet_CanPublish()
{
using (var testDirectory = TestDirectory.Create())
{
var projectName = "ClassLibrary1";
var workingDirectory = Path.Combine(testDirectory, projectName);
// Act
msbuildFixture.CreateDotnetNewProject(testDirectory.Path, projectName, " console");

var projectFile = Path.Combine(workingDirectory, $"{projectName}.csproj");
using (var stream = new FileStream(projectFile, FileMode.Open, FileAccess.ReadWrite))
{
var xml = XDocument.Load(stream);
ProjectFileUtils.AddProperty(xml, "GeneratePackageOnBuild", "true");
ProjectFileUtils.WriteXmlToFile(xml, stream);
}
// Act
var result = msbuildFixture.RunDotnet(workingDirectory, $"publish {projectFile}");

// Assert
Assert.True(result.Success);
}
}
}
}