diff --git a/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.Analyzers.props b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.Analyzers.props
new file mode 100644
index 000000000..ae36dddcd
--- /dev/null
+++ b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.Analyzers.props
@@ -0,0 +1,43 @@
+
+
+
+
+
+ isolated
+ true
+ true
+ true
+ true
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.Analyzers.targets b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.Analyzers.targets
new file mode 100644
index 000000000..27b2f9f8c
--- /dev/null
+++ b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.Analyzers.targets
@@ -0,0 +1,18 @@
+
+
+
+
+
+ $(RootNamespace.Replace("-", "_"))
+
+
+
diff --git a/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.props b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.props
index 9dd105269..4c9651d75 100644
--- a/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.props
+++ b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.props
@@ -17,6 +17,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
+
diff --git a/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.targets b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.targets
index b17ee29ba..122011676 100644
--- a/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.targets
+++ b/src/Azure.Functions.Sdk/Targets/Azure.Functions.Sdk.targets
@@ -15,7 +15,6 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
-
<_AzureFunctionsVersionStandardized>$(AzureFunctionsVersion.ToLowerInvariant().Split('-')[0])
<_FunctionsRuntimeMajorVersion>$(_AzureFunctionsVersionStandardized.TrimStart('vV'))
@@ -24,6 +23,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
$(_ToolingSuffix)
+
diff --git a/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Items.cs b/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Items.cs
index 7076357a3..6d70cd0fd 100644
--- a/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Items.cs
+++ b/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Items.cs
@@ -8,6 +8,17 @@ namespace Azure.Functions.Sdk.Tests.Integration;
public partial class SdkEndToEndTests
{
+ private static readonly string[] CompilerVisiblePropertiesExpected =
+ [
+ "FunctionsEnableMetadataSourceGen",
+ "FunctionsAutoRegisterGeneratedMetadataProvider",
+ "FunctionsEnableExecutorSourceGen",
+ "FunctionsAutoRegisterGeneratedFunctionsExecutor",
+ "FunctionsGeneratedCodeNamespace",
+ "TargetFrameworkIdentifier",
+ "FunctionsExecutionModel",
+ ];
+
[Fact]
public void Item_LocalSettingsJson_ExpectedMetadata()
{
@@ -45,7 +56,7 @@ public void Item_HostJson_ExpectedMetadata()
}
[Fact]
- public void Item_WorkerPackage_IsIncluded()
+ public void Item_ImplicitPackages_AreIncluded()
{
// Arrange
ProjectCreator project = ProjectCreator.Templates.AzureFunctionsProject(
@@ -56,9 +67,32 @@ public void Item_WorkerPackage_IsIncluded()
// Assert
items.Should().ContainSingle(x => x.EvaluatedInclude == "Microsoft.Azure.Functions.Worker")
- .Which.Should()
- .HaveMetadata("Version", "2.2.0")
- .And.HaveMetadata("IsImplicitlyDefined", "true");
+ .Which.Should().HaveMetadata("IsImplicitlyDefined", "true");
+
+ items.Should().ContainSingle(x => x.EvaluatedInclude == "Microsoft.Azure.Functions.Worker.Sdk.Analyzers")
+ .Which.Should().HaveMetadata("IsImplicitlyDefined", "true")
+ .And.HaveMetadata("PrivateAssets", "all");
+
+ items.Should().ContainSingle(x => x.EvaluatedInclude == "Microsoft.Azure.Functions.Worker.Sdk.Generators")
+ .Which.Should().HaveMetadata("IsImplicitlyDefined", "true")
+ .And.HaveMetadata("PrivateAssets", "all");
+ }
+
+ [Fact]
+ public void Item_CompilerVisibleProperty_AreIncluded()
+ {
+ // Arrange
+ ProjectCreator project = ProjectCreator.Templates.AzureFunctionsProject(
+ GetTempCsproj());
+
+ // Act
+ project.TryGetItems("CompilerVisibleProperty", out IReadOnlyCollection? items);
+
+ // Assert
+ foreach (string expected in CompilerVisiblePropertiesExpected)
+ {
+ items.Should().ContainSingle(x => x.EvaluatedInclude == expected);
+ }
}
[Fact]
diff --git a/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Properties.cs b/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Properties.cs
index 07929e4bb..1c517f355 100644
--- a/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Properties.cs
+++ b/test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Properties.cs
@@ -58,4 +58,19 @@ public void Property_ToolingSuffix_NetFx_MatchesTargetFramework(string tfm)
// Assert
toolingSuffix.Should().Be("netfx-isolated");
}
+
+ [Fact]
+ public void Property_AnalyzerProperties_ArePresent()
+ {
+ // Arrange
+ ProjectCreator project = ProjectCreator.Templates.AzureFunctionsProject(
+ GetTempCsproj());
+
+ // Act & Assert
+ foreach (string property in CompilerVisiblePropertiesExpected)
+ {
+ project.TryGetPropertyValue(property, out string? value);
+ value.Should().NotBeNullOrEmpty($"Property '{property}' should have a value.");
+ }
+ }
}