Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core Tools OOP Host #3802

Merged
merged 70 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
704ac4e
this doesn't work
aishwaryabh Aug 27, 2024
3c2d57e
this finally works now
aishwaryabh Aug 27, 2024
8e1a8b8
default should be oop host
aishwaryabh Aug 28, 2024
dba7366
added edge cases
aishwaryabh Aug 28, 2024
e10e828
fixing formatting
aishwaryabh Aug 28, 2024
8cace5c
using determineTargetFramework
aishwaryabh Sep 4, 2024
b3edb40
Merge branch 'v4.x' of https://github.com/Azure/azure-functions-core-…
aishwaryabh Sep 4, 2024
e8513a6
saving tests
aishwaryabh Sep 5, 2024
58cec33
adding copy step for OOP
aishwaryabh Sep 5, 2024
bda722f
fixing the webhost reference
aishwaryabh Sep 5, 2024
8cb1b78
removing test
aishwaryabh Sep 5, 2024
cef04a0
setting host version in ps script
aishwaryabh Sep 6, 2024
fa7d681
update to validate worker versions script
aishwaryabh Sep 7, 2024
0a85400
update versions for worker packages
aishwaryabh Sep 9, 2024
654e34b
adding ToString
aishwaryabh Sep 9, 2024
ba31c33
validating worker version
aishwaryabh Sep 9, 2024
e420bee
validate worker versions
aishwaryabh Sep 9, 2024
9689ef4
updating csproj to compile
aishwaryabh Sep 9, 2024
f705868
addressing pr feedback
aishwaryabh Sep 9, 2024
c175762
updating build steps
aishwaryabh Sep 9, 2024
83c0a23
Merge branch 'v4.x' of https://github.com/Azure/azure-functions-core-…
aishwaryabh Sep 9, 2024
d018052
adding build step
aishwaryabh Sep 9, 2024
9e65428
fixing build step
aishwaryabh Sep 9, 2024
26d67e5
trying to get this working
aishwaryabh Sep 10, 2024
91aae46
reverrting target runtimes
aishwaryabh Sep 10, 2024
8468773
updating tests
aishwaryabh Sep 10, 2024
8f51faa
adding dotnet info step
aishwaryabh Sep 10, 2024
eb07a1f
adding changes
aishwaryabh Sep 11, 2024
06b6bd7
removing extra test
aishwaryabh Sep 11, 2024
525aa6b
trying to specify architecture
aishwaryabh Sep 11, 2024
38b3920
modifying tests to see if they work
aishwaryabh Sep 11, 2024
553cc71
narrowing down to tests that are failing
aishwaryabh Sep 11, 2024
836d939
trying to see if it works with nobuild flag
aishwaryabh Sep 12, 2024
b0d8e5c
addressing pr feedback
aishwaryabh Sep 12, 2024
68800d6
updating tests with latest logging
aishwaryabh Sep 12, 2024
d544912
addressing comments and marking flaky tests
aishwaryabh Sep 12, 2024
16dfee4
updating so that we are only using net8 framework
aishwaryabh Sep 16, 2024
55f42ad
pushing change for branch build
aishwaryabh Sep 16, 2024
ec55012
adding single quotes
aishwaryabh Sep 16, 2024
125f0be
reverting quotes
aishwaryabh Sep 16, 2024
6a5e6e0
adding code mirror fiile
aishwaryabh Sep 16, 2024
622c3fb
updating build step
aishwaryabh Sep 16, 2024
d1da564
updatinng build steps
aishwaryabh Sep 16, 2024
bfdaff0
updating build step
aishwaryabh Sep 16, 2024
2c29257
Merge branch 'v4.x' of https://github.com/Azure/azure-functions-core-…
aishwaryabh Sep 17, 2024
b832675
adding step for dotnet publish
aishwaryabh Sep 17, 2024
6726456
set inprochost compilation system to diff value and skip flaky test
aishwaryabh Sep 17, 2024
f7e520b
updating public build pipeline to trigger
aishwaryabh Sep 17, 2024
bf47a3c
adding extra changes for pipeline
aishwaryabh Sep 17, 2024
09dec2b
public build yml
aishwaryabh Sep 17, 2024
5ac6edf
updating official build
aishwaryabh Sep 17, 2024
52e9289
readd net8 build artifact step
aishwaryabh Sep 17, 2024
c2813c5
readding space back
aishwaryabh Sep 17, 2024
c9844d1
addressing initial comments
aishwaryabh Sep 18, 2024
b13a532
adding explicit openTelemetry dlls
aishwaryabh Sep 18, 2024
697847d
simplifying logic of startHostAction
aishwaryabh Sep 18, 2024
4d9681f
addressing PR feedback
aishwaryabh Sep 18, 2024
ba7caec
start tests
aishwaryabh Sep 18, 2024
4821e73
changing some of the tests back
aishwaryabh Sep 18, 2024
b656fa1
reverting test back to normal
aishwaryabh Sep 19, 2024
7545285
fixing spacing for csproj
aishwaryabh Sep 19, 2024
e21065e
addressing PR feedback
aishwaryabh Sep 19, 2024
490eaf9
adding extra variable
aishwaryabh Sep 19, 2024
456aaa7
adding logic for edge case scenarios
aishwaryabh Sep 19, 2024
da89da0
added edge cases tests
aishwaryabh Sep 19, 2024
1bbca61
Merge branch 'feature/oop-host' of https://github.com/Azure/azure-fun…
aishwaryabh Sep 19, 2024
2cdbfe8
removing extra line in node
aishwaryabh Sep 19, 2024
cc01008
addressing comments
aishwaryabh Sep 20, 2024
72af8da
moving validate host runtime to its own method
aishwaryabh Sep 20, 2024
8b31c8e
forgot to add return statement
aishwaryabh Sep 20, 2024
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
132 changes: 120 additions & 12 deletions src/Azure.Functions.Cli/Actions/HostActions/StartHostAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Azure.Functions.Cli.Common;
Expand All @@ -18,12 +19,14 @@
using Azure.Functions.Cli.NativeMethods;
using Colors.Net;
using Fclp;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Script;
using Microsoft.Azure.WebJobs.Script.Configuration;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.WebHost;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -44,6 +47,7 @@ internal class StartHostAction : BaseAction
private const string WindowsExecutableName = "func.exe";
private const string LinuxExecutableName = "func";
private const string InProc8DirectoryName = "in-proc8";
private const string OutOfProcDirectoryName = "out-of-proc";
private readonly ISecretsManager _secretsManager;
private readonly IProcessManager _processManager;
private IConfigurationRoot _hostJsonConfig;
Expand Down Expand Up @@ -81,6 +85,8 @@ internal class StartHostAction : BaseAction

public string JsonOutputFile { get; set; }

public string? SetHostRuntime { get; set; }
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved

public StartHostAction(ISecretsManager secretsManager, IProcessManager processManager)
{
_secretsManager = secretsManager;
Expand Down Expand Up @@ -176,6 +182,11 @@ public override ICommandLineParserResult ParseArgs(string[] args)
.WithDescription("If provided, a path to the file that will be used to write the output when using --enable-json-output.")
.Callback(jsonOutputFile => JsonOutputFile = jsonOutputFile);

Parser
.Setup<string>("runtime")
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
.WithDescription("If provided, determines which version of the host to start.")
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
.Callback(startHostAction => SetHostRuntime = startHostAction);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a more descriptive argument name here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For runtime?


var parserResult = base.ParseArgs(args);
bool verboseLoggingArgExists = parserResult.UnMatchedOptions.Any(o => o.LongName.Equals("verbose", StringComparison.OrdinalIgnoreCase));
// Input args do not contain --verbose flag
Expand Down Expand Up @@ -418,15 +429,104 @@ private async Task<JObject> GetLocalSettingsJsonAsJObjectAsync()
public override async Task RunAsync()
{
await PreRunConditions();
var isVerbose = VerboseLogging.HasValue && VerboseLogging.Value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this logic that is specific to .NET to a different method and out of RunAsync? That will help declutter this method and make the code easier to navigate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also enable you to reduce the variables as you'll be able to drive the logic without needing to have an additional flag for OOP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this logic into: ShouldExitAfterDeterminingHostRuntime to clean up RunAsync


var isCurrentProcessNet6Build = RuntimeInformation.FrameworkDescription.Contains(Net6FrameworkDescriptionPrefix);
if (isCurrentProcessNet6Build && ShouldLaunchInProcNet8AsChildProcess() && await IsInProcNet8Enabled())
if (SetHostRuntime != null)
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
if (SetHostRuntime == "default")
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
if (isCurrentProcessNet6Build)
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected out-of-process host"));
}
await StartHostAsChildProcessAsync(true);
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
return;
}
}
else if (SetHostRuntime == "inproc8")
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
if (isCurrentProcessNet6Build && ShouldLaunchInProcNet8AsChildProcess() && await IsInProcNet8Enabled())
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected inproc8 host"));
}
await StartHostAsChildProcessAsync(false);
return;
}

}
else if (SetHostRuntime == "inproc6")
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected inproc6 host"));
}
if (!isCurrentProcessNet6Build)
{
throw new CliException($"Cannot set host runtime to '{SetHostRuntime}' for the current process. The current process is not a .NET 6 build.");
}
}
else
{
throw new CliException($"Invalid host runtime '{SetHostRuntime}'. Valid values are 'default', 'in-proc8', 'in-proc6'.");
}
}
else
{
await StartInProc8AsChildProcessAsync();
return;
// We should try to infer if we run inproc6 host, inproc8 host, or OOP host (default)
var functionAppRoot = ScriptHostHelpers.GetFunctionAppRootDirectory(Environment.CurrentDirectory);

// Get the WorkerRuntime
var workerRuntime = GlobalCoreToolsSettings.CurrentWorkerRuntime;
string targetFramework = "";

string projectFilePath = ProjectHelpers.FindProjectFile(functionAppRoot);
if (projectFilePath != null)
{
targetFramework = await DotnetHelpers.DetermineTargetFramework(Path.GetDirectoryName(projectFilePath));
}

bool shouldLaunchOopProcess = true;

// Check if the app is in-proc
if (workerRuntime == WorkerRuntime.dotnet)
{
// Start .NET 8 child process if InProc8 is enabled and if TFM of function app is .NET 8
if (isCurrentProcessNet6Build && ShouldLaunchInProcNet8AsChildProcess() && await IsInProcNet8Enabled() && targetFramework == "net8.0")
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected inproc8 host"));
}
await StartHostAsChildProcessAsync(false);
return;
}
// Start .NET 6 process if TFM of function app is .NET 6
else if (isCurrentProcessNet6Build && targetFramework == "net6.0")
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected inproc6 host"));
}
shouldLaunchOopProcess = false;
}
}
// If the above conditions fail, the default should be OOP host
if (isCurrentProcessNet6Build && shouldLaunchOopProcess)
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected out-of-process host"));
}
await StartHostAsChildProcessAsync(true);
return;
}
}

var isVerbose = VerboseLogging.HasValue && VerboseLogging.Value;
if (isVerbose || EnvironmentHelper.GetEnvironmentVariableAsBool(Constants.DisplayLogo))
{
Utilities.PrintLogo();
Expand Down Expand Up @@ -488,23 +588,31 @@ private static string GetInProcNet8ExecutablePath()
return Path.Combine(funcExecutableDirectory, InProc8DirectoryName, executableName);
}

private Task StartInProc8AsChildProcessAsync()
private static string GetOutOfProcExecutablePath()
{
var funcExecutableDirectory = Path.GetDirectoryName(typeof(StartHostAction).Assembly.Location)!;
var executableName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? WindowsExecutableName : LinuxExecutableName;

return Path.Combine(funcExecutableDirectory, OutOfProcDirectoryName, executableName);
}

private Task StartHostAsChildProcessAsync(bool isOutOfProc)
{
if (VerboseLogging == true)
{
ColoredConsole.WriteLine(VerboseColor($"Starting child process for in-process model host."));
ColoredConsole.WriteLine(VerboseColor($"Starting child process for {(isOutOfProc ? "out-of-process" : "in-process")} model host."));
}

var commandLineArguments = string.Join(" ", Environment.GetCommandLineArgs().Skip(1));
var tcs = new TaskCompletionSource();

var inProc8FuncExecutablePath = GetInProcNet8ExecutablePath();
var funcExecutablePath = isOutOfProc? GetOutOfProcExecutablePath(): GetInProcNet8ExecutablePath();

EnsureNet8FuncExecutablePresent(inProc8FuncExecutablePath);
EnsureNet8FuncExecutablePresent(funcExecutablePath);

var inprocNet8ChildProcessInfo = new ProcessStartInfo
var childProcessInfo = new ProcessStartInfo
{
FileName = inProc8FuncExecutablePath,
FileName = funcExecutablePath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we use the --no-build argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it in line 626?

Arguments = $"{commandLineArguments} --no-build",
WorkingDirectory = Environment.CurrentDirectory,
UseShellExecute = false,
Expand All @@ -515,7 +623,7 @@ private Task StartInProc8AsChildProcessAsync()

try
{
var childProcess = Process.Start(inprocNet8ChildProcessInfo);
var childProcess = Process.Start(childProcessInfo);
if (VerboseLogging == true)
{
ColoredConsole.WriteLine(VerboseColor($"Started child process with ID: {childProcess.Id}"));
Expand Down Expand Up @@ -546,7 +654,7 @@ private Task StartInProc8AsChildProcessAsync()
}
catch (Exception ex)
{
throw new CliException($"Failed to start the in-process model host. {ex.Message}");
throw new CliException($"Failed to start the {(isOutOfProc ? "out-of-process" : "in-process")} model host. {ex.Message}");
}

return tcs.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Azure.Functions.Cli.Interfaces;
using Colors.Net;
using Fclp;
using ImTools;
using Microsoft.Azure.AppService.Proxy.Common.Context;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Script;
Expand Down
56 changes: 39 additions & 17 deletions src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ExcludeWorkersFromReadyToRun">
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ExcludeWorkersFromReadyToRun">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
Expand Down Expand Up @@ -40,6 +40,9 @@
<PropertyGroup Condition="'$(SkipInProcessHost)' == 'True'">
<DefineConstants>SkipInProcessHost</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<PublishOutofProcessHost>True</PublishOutofProcessHost>
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64' OR '$(RuntimeIdentifier)' == 'win-x86'">
<PublishReadyToRun>false</PublishReadyToRun>
<PublishReadyToRunShowWarnings>false</PublishReadyToRunShowWarnings>
Expand Down Expand Up @@ -274,46 +277,65 @@
<ItemGroup>
<PackageReference Include="Autofac" Version="4.6.2" />
<PackageReference Include="Azure.Identity" Version="1.11.4" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.2.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageReference Include="Colors.Net" Version="1.1.0" />
<PackageReference Include="AccentedCommandLineParser" Version="2.0.0" />
<PackageReference Include="DotNetZip" Version="1.13.3" />
<PackageReference Include="DotNetZip" Version="1.16.0" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage.Internal" Version="1.4.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="4.35.4" />
<PackageReference Include="Microsoft.Build" Version="17.0.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NuGet.Packaging" Version="5.11.6" />
<PackageReference Include="System.Formats.Asn1" Version="6.0.1" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.1" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
</ItemGroup>
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0' AND '$(PublishOutofProcessHost)'=='True'">
<PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="4.1036.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net6.0' OR ('$(TargetFramework)'=='net8.0' AND '$(PublishOutofProcessHost)'=='False')">
<PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="4.35.3" />
</ItemGroup>
<ItemGroup Condition="'$(NoWorkers)' != 'true'">
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.14.0" />
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="20240410.1.0-v4" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.0" Version="4.0.3148" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.3220" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.3219" />
<PackageReference Include="Microsoft.Azure.Functions.PythonWorker" Version="4.29.0" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.4020" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4021" />
<PackageReference Include="Microsoft.Azure.Functions.PythonWorker" Version="4.31.0" />
</ItemGroup>
<Target Name="ExcludeWorkersFromReadyToRun">
<CreateItem Include="%(None.Filename)%(None.Extension)" Condition="$([System.String]::new('%(None.TargetPath)').StartsWith('workers'))" PreserveExistingMetadata="false">
<Output TaskParameter="Include" ItemName="PublishReadyToRunExclude" />
</CreateItem>
</Target>
<!-- Build/Publish for OOP host as well-->
<Target Name="BuildOutOfProc" AfterTargets="Build" Condition="'$(TargetFramework)'=='net6.0' AND '$(PublishOutofProcessHost)'=='True'">
<PropertyGroup>
<RuntimeIdentifierOption Condition="'$(RuntimeIdentifier)' != ''">-r $(RuntimeIdentifier)</RuntimeIdentifierOption>
</PropertyGroup>
<Exec Command="dotnet publish -c $(Configuration) -f net8.0 --output $(OutputPath)/out-of-proc $(RuntimeIdentifierOption) -p:NoWorkers=True --self-contained" />
</Target>
<Target Name="PublishOutOfProc" AfterTargets="Publish" Condition="'$(TargetFramework)'=='net6.0' AND '$(PublishOutofProcessHost)'=='True'">
<PropertyGroup>
<RuntimeIdentifierOption Condition="'$(RuntimeIdentifier)' != ''">-r $(RuntimeIdentifier)</RuntimeIdentifierOption>
</PropertyGroup>
<Exec Command="dotnet publish -c $(Configuration) -f net8.0 --output $(PublishDir)/out-of-proc $(RuntimeIdentifierOption) -p:NoWorkers=True --self-contained" />
</Target>

<!-- Build/Publish for net8.0 TFM as well-->
<Target Name="BuildInProcNet8" AfterTargets="Build" Condition="'$(TargetFramework)'=='net6.0' AND '$(SkipInProcessHost)'!='True'">
<PropertyGroup>
<RuntimeIdentifierOption Condition="'$(RuntimeIdentifier)' != ''">-r $(RuntimeIdentifier)</RuntimeIdentifierOption>
</PropertyGroup>
<Exec Command="dotnet publish -c $(Configuration) -f net8.0 --output $(OutputPath)/in-proc8 $(RuntimeIdentifierOption) -p:NoWorkers=True --self-contained" />
<PropertyGroup>
<RuntimeIdentifierOption Condition="'$(RuntimeIdentifier)' != ''">-r $(RuntimeIdentifier)</RuntimeIdentifierOption>
</PropertyGroup>
<Exec Command="dotnet publish -c $(Configuration) -f net8.0 --output $(OutputPath)/in-proc8 $(RuntimeIdentifierOption) -p:NoWorkers=True -p:PublishOutOfProcessHost=False --self-contained" />
</Target>
<Target Name="PublishInProcNet8" AfterTargets="Publish" Condition="'$(TargetFramework)'=='net6.0' AND '$(SkipInProcessHost)'!='True'">
<PropertyGroup>
<RuntimeIdentifierOption Condition="'$(RuntimeIdentifier)' != ''">-r $(RuntimeIdentifier)</RuntimeIdentifierOption>
</PropertyGroup>
<Exec Command="dotnet publish -c $(Configuration) -f net8.0 --output $(PublishDir)/in-proc8 $(RuntimeIdentifierOption) -p:NoWorkers=True --self-contained" />
<PropertyGroup>
<RuntimeIdentifierOption Condition="'$(RuntimeIdentifier)' != ''">-r $(RuntimeIdentifier)</RuntimeIdentifierOption>
</PropertyGroup>
<Exec Command="dotnet publish -c $(Configuration) -f net8.0 --output $(PublishDir)/in-proc8 $(RuntimeIdentifierOption) -p:NoWorkers=True -p:PublishOutOfProcessHost=False --self-contained" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.6" />
<PackageReference Include="System.IO.Abstractions" Version="2.1.0.227" />
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<ItemGroup>
Expand All @@ -45,8 +46,11 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Azure.Functions.Cli\Azure.Functions.Cli.csproj" />
</ItemGroup>
<!-- The "in-proc8" directory content is created using an msbuild target in "Azure.Functions.Cli" project and they don't automatically gets copied to the test project output directory -->
<!-- The "in-proc8" and "out-of-proc" directory content is created using an msbuild target in "Azure.Functions.Cli" project and they don't automatically gets copied to the test project output directory -->
<Target Name="CopyInProc8" AfterTargets="Build" Condition="'$(TargetFramework)'=='net6.0'">
<Exec Command="xcopy /Y /I /E &quot;$(MSBuildThisFileDirectory)..\..\src\Azure.Functions.Cli\bin\$(Configuration)\$(TargetFramework)\in-proc8\*&quot; &quot;$(OutDir)in-proc8\&quot;" />
</Target>
<Target Name="CopyOutOfProc" AfterTargets="Build" Condition="'$(TargetFramework)'=='net6.0'">
<Exec Command="xcopy /Y /I /E &quot;$(MSBuildThisFileDirectory)..\..\src\Azure.Functions.Cli\bin\$(Configuration)\$(TargetFramework)\out-of-proc\*&quot; &quot;$(OutDir)out-of-proc\&quot;" />
</Target>
</Project>
Loading
Loading