Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.
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
19 changes: 14 additions & 5 deletions source/OctoPack.Tests/Integration/BuildFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,22 @@ protected static void MsBuild(string commandLineArguments, Action<string> output
private static string GetMsBuildPath()
{
string msBuild;

var programFilesDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
foreach (var version in new []{"14.0","12.0"})
foreach (var version in new[] { "Current", "15.0", "14.0", "12.0" })
{
var buildDirectory = Path.Combine(programFilesDirectory, "MSBuild", version, "Bin");
msBuild = Path.Combine(buildDirectory, "msbuild.exe");
if (File.Exists(msBuild))
return msBuild;
// As of Visual Studio 2017, Microsoft changed where the MSBuild tools reside. As of Visual Studio 2019, Microsoft stopped using
// a version number, such as 15.0, in the path and now uses 'Current'.
// This additional loop accounts for MSBuild located in the Visual Studio installation path for both VS2017 and VS2019 Professional
// and enterprise editions. This is still fragile, as there are other editions of Visual Studio, and also does not account for
// the Visual Studio Build Tools (for 2017 and 2019).
// The last empty string array entry is for Visual Studio 2015 and below.
foreach (var msBuildBasePath in new[] { "Microsoft Visual Studio\\2019\\Professional", "Microsoft Visual Studio\\2019\\Enterprise", "Microsoft Visual Studio\\2017\\Professional", "Microsoft Visual Studio\\2017\\Enterprise", "" })
{
msBuild = Path.Combine(programFilesDirectory, msBuildBasePath, "MSBuild", version, "Bin", "msbuild.exe");
if (File.Exists(msBuild))
return msBuild;
}
}
var netFx = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
msBuild = Path.Combine(netFx, "msbuild.exe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

namespace OctoPack.Tests.Integration
{
[TestFixture]
[TestFixture, Category("Integration Tests")]
public class SampleSolutionBuildFixture : BuildFixture
{
[Test]
public void ShouldBuildAtSolutionLevel()
{
MsBuild("Samples.sln /p:RunOctoPack=true /p:OctoPackPackageVersion=1.0.9 /p:Configuration=Release /v:m");

AssertPackage(@"Sample.ConsoleApp\obj\octopacked\Sample.ConsoleApp.1.0.9.nupkg",
AssertPackage(@"Sample.ConsoleApp\obj\octopacked\Sample.ConsoleApp.1.0.9.nupkg",
pkg => pkg.AssertContents(
"Sample.ConsoleApp.exe",
"Sample.ConsoleApp.exe.config",
Expand Down
10 changes: 5 additions & 5 deletions source/build/OctoPack.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
OctoPack
</BuildDependsOn>
</PropertyGroup>

<!--
Configuration properties - you can override these from the command line
-->
Expand Down Expand Up @@ -40,7 +40,7 @@
<OctoPackUseProductVersion Condition="'$(OctoPackUseProductVersion)' == ''">false</OctoPackUseProductVersion>
</PropertyGroup>

<!--
<!--
Create Octopus Deploy package
-->
<Target Name="OctoPack" Condition="$(RunOctoPack)">
Expand All @@ -67,13 +67,13 @@

<ItemGroup>

<OctoPackWrittenFiles Include="@(FileWrites)" Exclude="$(IntermediateOutputPath)**\*" />
<OctoPackWrittenFiles Include="@(FileWrites)" Exclude="$(IntermediateOutputPath)**\*;@(CopyUpToDateMarker)" />
<OctoPackWrittenFiles Include="@(FileWritesShareable)" Exclude="$(IntermediateOutputPath)**\*" />

<OctoPackContentFiles Include="@(Content)" />
<OctoPackContentFiles Include="@(TypeScriptCompile)" />
</ItemGroup>

<CreateOctoPackPackage
NuSpecFileName="$(OctoPackNuSpecFileName)"
AppendToPackageId="$(OctoPackAppendToPackageId)"
Expand Down