Skip to content

Commit 6413951

Browse files
committed
Adding extension.csproj file for correctly loading extensions.dll
1 parent 810a10b commit 6413951

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

azure_functions_worker/testutils.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,27 @@
8787
"prefetchCount": 1000,
8888
"batchCheckpointFrequency": 1
8989
},
90-
"functionTimeout": "00:05:00",
91-
"extensionBundle": {
92-
"id": "Microsoft.Azure.Functions.ExtensionBundle",
93-
"version": "[2.*, 3.0.0)"
94-
}
90+
"functionTimeout": "00:05:00"
9591
}
9692
"""
9793

94+
EXTENSION_CSPROJ_TEMPLATE = """\
95+
<Project Sdk="Microsoft.NET.Sdk">
96+
<PropertyGroup>
97+
<TargetFramework>netcoreapp3.1</TargetFramework>
98+
<WarningsAsErrors></WarningsAsErrors>
99+
<DefaultItemExcludes>**</DefaultItemExcludes>
100+
</PropertyGroup>
101+
<ItemGroup>
102+
<PackageReference
103+
Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.0.0" />
104+
<PackageReference
105+
Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator"
106+
Version="1.1.3" />
107+
</ItemGroup>
108+
</Project>
109+
"""
110+
98111
SECRETS_TEMPLATE = """\
99112
{
100113
"masterKey": {
@@ -976,11 +989,16 @@ def _setup_func_app(app_root):
976989
extensions = app_root / 'bin'
977990
ping_func = app_root / 'ping'
978991
host_json = app_root / 'host.json'
992+
csproj_file = app_root / 'extensions.csproj'
979993

980994
if not os.path.isfile(host_json):
981995
with open(host_json, 'w') as f:
982996
f.write(HOST_JSON_TEMPLATE)
983997

998+
if not os.path.isfile(csproj_file):
999+
with open(csproj_file, 'w') as f:
1000+
f.write(EXTENSION_CSPROJ_TEMPLATE)
1001+
9841002
_symlink_dir(TESTS_ROOT / 'common' / 'ping', ping_func)
9851003
_symlink_dir(EXTENSIONS_PATH, extensions)
9861004

@@ -989,8 +1007,9 @@ def _teardown_func_app(app_root):
9891007
extensions = app_root / 'bin'
9901008
ping_func = app_root / 'ping'
9911009
host_json = app_root / 'host.json'
1010+
csproj_file = app_root / 'extensions.csproj'
9921011

993-
for path in (extensions, ping_func, host_json):
1012+
for path in (extensions, ping_func, host_json, csproj_file):
9941013
remove_path(path)
9951014

9961015

0 commit comments

Comments
 (0)