Skip to content

Commit

Permalink
Adding the option to choose the FunctionsGenerator framework
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayrkn committed Oct 4, 2017
1 parent 92f455a commit 1b28b41
Show file tree
Hide file tree
Showing 69 changed files with 431 additions and 175 deletions.
14 changes: 10 additions & 4 deletions FunctionsSdk.sln
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
VisualStudioVersion = 15.0.26927.3000
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{14D6456E-2F9D-4483-A378-03701A6EB12D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{9B6D0171-3FFD-4892-B407-B633CA4E6712}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Functions.MSBuild", "src\Microsoft.NET.Sdk.Functions.MSBuild\Microsoft.NET.Sdk.Functions.MSBuild.csproj", "{D1A5EEB2-A8D0-4E7A-8FBF-CFC5D2C23B96}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.NET.Sdk.Functions.MSBuild.Tests", "test\Microsoft.NET.Sdk.Functions.MSBuild.Tests\Microsoft.NET.Sdk.Functions.MSBuild.Tests.csproj", "{9D59910B-B90E-4BBE-BD26-C2CBF85D37E1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.NET.Sdk.Functions.Generator.Tests", "test\Microsoft.NET.Sdk.Functions.Generator.Tests\Microsoft.NET.Sdk.Functions.Generator.Tests.csproj", "{9D59910B-B90E-4BBE-BD26-C2CBF85D37E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "pack", "pack", "{8D555953-A625-4C7F-93A7-C737644820AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Functions", "pack\Microsoft.NET.Sdk.Functions\Microsoft.NET.Sdk.Functions.csproj", "{5DCBB929-5248-4701-82C9-88BB566E404C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Functions.Console", "src\Microsoft.NET.Sdk.Functions.Console\Microsoft.NET.Sdk.Functions.Console.csproj", "{6CEDE940-9F0A-4B2A-97D4-D1EEEE42AF35}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Functions.Generator", "src\Microsoft.NET.Sdk.Functions.Generator\Microsoft.NET.Sdk.Functions.Generator.csproj", "{6CEDE940-9F0A-4B2A-97D4-D1EEEE42AF35}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Msbuild.Workaround", "src\Msbuild.Workaround\Msbuild.Workaround.csproj", "{14DF7D60-3AE6-4A5C-A2FF-BE49720DDFEC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Functions.NETStandard", "src\Microsoft.NET.Sdk.Functions.NETStandard\Microsoft.NET.Sdk.Functions.NETStandard.csproj", "{14DF7D60-3AE6-4A5C-A2FF-BE49720DDFEC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{03DEE129-17B6-4CE0-B2D8-5B648D5BEE64}"
ProjectSection(SolutionItems) = preProject
build.cmd = build.cmd
devbuild.cmd = devbuild.cmd
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
71 changes: 55 additions & 16 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ REM build the functions sdk.
dotnet build src\Microsoft.NET.Sdk.Functions.MSBuild --configuration=Release
if errorlevel 1 GOTO ERROR

REM build the functions sdk.
dotnet build src\Microsoft.NET.Sdk.Functions.Console --configuration=Release
if errorlevel 1 GOTO ERROR

dotnet publish src\Microsoft.NET.Sdk.Functions.Console --configuration=Release --output=bin\publish --framework=netcoreapp2.0
REM build the functions generator
dotnet build src\Microsoft.NET.Sdk.Functions.Generator --configuration=Release
if errorlevel 1 GOTO ERROR

REM Pack the functions sdk
Expand All @@ -25,32 +22,74 @@ REM Restore the NuGet.exe
dotnet restore sample\NuGet\NuGet.csproj
if errorlevel 1 GOTO ERROR

REM Restore the sample project.
%userprofile%\.nuget\packages\nuget.commandline\4.1.0\tools\nuget.exe restore sample\FunctionApp\FunctionApp.sln

REM ***************************NETFramework************************************

REM Restore the sample NETFramework project.
%userprofile%\.nuget\packages\nuget.commandline\4.1.0\tools\nuget.exe restore sample\FunctionAppNETFramework\FunctionAppNETFramework.sln
if errorlevel 1 GOTO ERROR

REM Build the sample solution.
msbuild sample\FunctionApp\FunctionApp.sln /p:configuration=Release
REM Build the sample NETFramework solution.
msbuild sample\FunctionAppNETFramework\FunctionAppNETFramework.sln /p:configuration=Release
if errorlevel 1 GOTO ERROR

REM Publish the sample functon app using the publish target.
msbuild sample\FunctionApp\FunctionApp\FunctionApp.csproj /t:Publish /p:PublishDir="bin\Release\dotnetpublishoutput" /p:configuration=Release
REM Publish the sample .NETFramework functon app using the publish target (full framework msbuild).
msbuild sample\FunctionAppNETFramework\FunctionAppNETFramework\FunctionAppNETFramework.csproj /t:Publish /p:PublishDir="bin\Release\dotnetpublishoutput" /p:configuration=Release
if errorlevel 1 GOTO ERROR

REM Publish the sample functon app using DeployOnBuild.
msbuild sample\FunctionApp\FunctionApp\FunctionApp.csproj /p:DeployOnBuild=true /p:PublishUrl="bin\Release\deployOnBuildOutput" /p:configuration=Release
REM Publish the sample .NETFramework functon app using DeployOnBuild (full framework msbuild).
msbuild sample\FunctionAppNETFramework\FunctionAppNETFramework\FunctionAppNETFramework.csproj /p:DeployOnBuild=true /p:PublishUrl="bin\Release\deployOnBuildOutput" /p:configuration=Release
if errorlevel 1 GOTO ERROR

dotnet test sample\FunctionApp\UnitTestProject2\UnitTestProject2.csproj --configuration=Release --no-build
REM Run tests on .NETFramework projects

dotnet test sample\FunctionAppNETFramework\UnitTestProject2\UnitTestProject2.csproj --configuration=Release --no-build
if errorlevel 1 GOTO ERROR

dotnet test sample\FunctionApp\XUnitTestProject1\XUnitTestProject1.csproj --configuration=Release --no-build
dotnet test sample\FunctionAppNETFramework\XUnitTestProject1\XUnitTestProject1.csproj --configuration=Release --no-build
if errorlevel 1 GOTO ERROR

REM run tests on unit test projects that references the functions project.
dotnet test sample\FunctionApp\UnitTestProject1\UnitTestProject1.csproj --configuration=Release --no-build
dotnet test sample\FunctionAppNETFramework\UnitTestProject1\UnitTestProject1.csproj --configuration=Release --no-build
if errorlevel 1 GOTO ERROR


REM ***************************NETStandard************************************


REM Restore the sample NETStandard project.
dotnet restore sample\FunctionAppNETStandard\FunctionAppNETStandard.sln
if errorlevel 1 GOTO ERROR

REM Build the sample NETStandard solution.
msbuild sample\FunctionAppNETStandard\FunctionAppNETStandard.sln /p:configuration=Release
if errorlevel 1 GOTO ERROR

REM Publish the sample .NETStandard functon app using the publish target (core msbuild).
dotnet build sample\FunctionAppNETStandard\FunctionAppNETStandard\FunctionAppNETStandard.csproj /t:Publish /p:PublishDir="bin\Release\core\dotnetpublishoutput" /p:configuration=Release
if errorlevel 1 GOTO ERROR

REM Publish the sample .NETStandard functon app using DeployOnBuild (core msbuild).
dotnet build sample\FunctionAppNETStandard\FunctionAppNETStandard\FunctionAppNETStandard.csproj /p:DeployOnBuild=true /p:PublishUrl="bin\Release\core\deployOnBuildOutput" /p:configuration=Release
if errorlevel 1 GOTO ERROR

REM Publish the sample .NETStandard functon app using the publish target (full framework msbuild).
msbuild sample\FunctionAppNETStandard\FunctionAppNETStandard\FunctionAppNETStandard.csproj /t:Publish /p:PublishDir="bin\Release\full\dotnetpublishoutput" /p:configuration=Release
if errorlevel 1 GOTO ERROR

REM Publish the sample .NETStandard functon app using DeployOnBuild (full framework msbuild).
msbuild sample\FunctionAppNETStandard\FunctionAppNETStandard\FunctionAppNETStandard.csproj /p:DeployOnBuild=true /p:PublishUrl="bin\Release\full\deployOnBuildOutput" /p:configuration=Release
if errorlevel 1 GOTO ERROR


REM Run tests on .NETStandard projects
dotnet test sample\FunctionAppNETStandard\UnitTestProject2\UnitTestProject2.csproj --configuration=Release --no-build
if errorlevel 1 GOTO ERROR

dotnet test sample\FunctionAppNETStandard\XUnitTestProject1\XUnitTestProject1.csproj --configuration=Release --no-build
if errorlevel 1 GOTO ERROR


:ERROR
endlocal
exit /b 1
7 changes: 2 additions & 5 deletions devbuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ REM build the functions sdk.
dotnet build src\Microsoft.NET.Sdk.Functions.MSBuild --configuration=Release
if errorlevel 1 GOTO ERROR

REM build the functions sdk.
dotnet build src\Microsoft.NET.Sdk.Functions.Console --configuration=Release
if errorlevel 1 GOTO ERROR

dotnet publish src\Microsoft.NET.Sdk.Functions.Console --configuration=Release --output=bin\publish --framework=netcoreapp2.0
REM build the functions generator
dotnet build src\Microsoft.NET.Sdk.Functions.Generator --configuration=Release
if errorlevel 1 GOTO ERROR

REM Pack the functions sdk
Expand Down
32 changes: 15 additions & 17 deletions pack/Microsoft.NET.Sdk.Functions/Microsoft.NET.Sdk.Functions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<PackageName>Microsoft.NET.Sdk.Functions</PackageName>
<PackageVersion>1.0.5</PackageVersion>
<PackageVersion>1.0.6</PackageVersion>
<AssemblyOriginatorKeyFile>PublicKey.snk</AssemblyOriginatorKeyFile>
<SignAssembly>false</SignAssembly>
<DelaySign>true</DelaySign>
<BuildOutputTargetFolder>tools</BuildOutputTargetFolder>
<FunctionsBuildTaskOutputPath>..\..\src\Microsoft.NET.Sdk.Functions.MSBuild\bin\Release</FunctionsBuildTaskOutputPath>
<FunctionsBuildToolOutputPath>..\..\src\Microsoft.NET.Sdk.Functions.Console\bin\Release</FunctionsBuildToolOutputPath>
<FunctionsBuildToolPublishOutputPath>..\..\src\Microsoft.NET.Sdk.Functions.Console\bin\publish</FunctionsBuildToolPublishOutputPath>
<FunctionsGeneratorOutputPath>..\..\src\Microsoft.NET.Sdk.Functions.Generator\bin\Release</FunctionsGeneratorOutputPath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,14 +25,7 @@

<Target Name="PackReferenceAssemblies" AfterTargets="Build">
<ItemGroup>
<None Include="$(FunctionsBuildTaskOutputPath)\net46\Newtonsoft.Json.dll">
<Pack>true</Pack>
<PackagePath>tools\net46\</PackagePath>
</None>
<None Include="$(FunctionsBuildToolPublishOutputPath)\Newtonsoft.Json.dll">
<Pack>true</Pack>
<PackagePath>tools\netstandard2.0\</PackagePath>
</None>
<!-- MSBuild task assemblies -->
<None Include="$(FunctionsBuildTaskOutputPath)\net46\Microsoft.NET.Sdk.Functions.MSBuild.dll">
<Pack>true</Pack>
<PackagePath>tools\net46\</PackagePath>
Expand All @@ -42,24 +34,30 @@
<Pack>true</Pack>
<PackagePath>tools\netstandard2.0\</PackagePath>
</None>

<None Include="$(FunctionsBuildToolOutputPath)\net461\Microsoft.NET.Sdk.Functions.Console.exe">

<!-- Generator and dependent assemblies-->
<None Include="$(FunctionsGeneratorOutputPath)\net461\Newtonsoft.Json.dll">
<Pack>true</Pack>
<PackagePath>tools\net46\</PackagePath>
</None>
<None Include="$(FunctionsBuildToolOutputPath)\net461\Newtonsoft.Json.dll">
<None Include="$(FunctionsGeneratorOutputPath)\net461\Microsoft.NET.Sdk.Functions.Generator.exe">
<Pack>true</Pack>
<PackagePath>tools\net46\</PackagePath>
</None>
<None Include="$(FunctionsBuildToolOutputPath)\net461\netstandard.dll">
<None Include="$(FunctionsGeneratorOutputPath)\net461\netstandard.dll">
<Pack>true</Pack>
<PackagePath>tools\net46\</PackagePath>
</None>
<None Include="$(FunctionsBuildToolOutputPath)\netcoreapp2.0\Microsoft.NET.Sdk.Functions.Console.dll">

<None Include="$(FunctionsGeneratorOutputPath)\netcoreapp2.0\Newtonsoft.Json.dll">
<Pack>true</Pack>
<PackagePath>tools\netstandard2.0\</PackagePath>
</None>
<None Include="$(FunctionsGeneratorOutputPath)\netcoreapp2.0\Microsoft.NET.Sdk.Functions.Generator.dll">
<Pack>true</Pack>
<PackagePath>tools\netstandard2.0\</PackagePath>
</None>
<None Include="$(FunctionsBuildToolOutputPath)\netcoreapp2.0\Microsoft.NET.Sdk.Functions.Console.runtimeconfig.json">
<None Include="$(FunctionsGeneratorOutputPath)\netcoreapp2.0\Microsoft.NET.Sdk.Functions.Generator.runtimeconfig.json">
<Pack>true</Pack>
<PackagePath>tools\netstandard2.0\</PackagePath>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.3
VisualStudioVersion = 15.0.26927.3000
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionApp", "FunctionApp\FunctionApp.csproj", "{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionAppNETFramework", "FunctionAppNETFramework\FunctionAppNETFramework.csproj", "{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject1", "UnitTestProject1\UnitTestProject1.csproj", "{B55C7FC7-6F6E-46AC-9E30-875461F5AD9D}"
EndProject
Expand All @@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUnitTestProject1", "XUnitT
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunctionsRefClassicClassLib", "FunctionsRefClassicClassLib\FunctionsRefClassicClassLib.csproj", "{18AC1ECC-D277-4653-A027-335EA7F3BA40}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunctionsRefSdkClassLib", "FunctionsRefSdkClassLib\FunctionsRefSdkClassLib.csproj", "{3745AA4F-DD9E-4768-BCFE-4879A94AD1C7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionsRefSdkClassLib", "FunctionsRefSdkClassLib\FunctionsRefSdkClassLib.csproj", "{3745AA4F-DD9E-4768-BCFE-4879A94AD1C7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.5" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FunctionsRefClassicClassLib\FunctionsRefClassicClassLib.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;

namespace FunctionApp
namespace FunctionAppNETFramework
{
public static class HttpTriggerCSharp
public static class HttpTriggerNETFramework
{
[FunctionName("HttpTriggerCSharp")]
[FunctionName("HttpTriggerNETFramework")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
{
//log.Info("C# HTTP trigger function processed a request.");
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Hosting;
using FunctionApp;
using FunctionAppNETFramework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
Expand All @@ -11,15 +11,15 @@ namespace UnitTestProject1
public class UnitTest1
{
[TestMethod]
public async Task ClassicUnitTestProject_Test()
public async Task ClassicUnitTestProject_Test_NETFx()
{
var requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://functions.azurewebsites.net?name=test")
{
Content = new StringContent(""),
Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } }
};

var response = await HttpTriggerCSharp.Run(requestMessage, null);
var response = await HttpTriggerNETFramework.Run(requestMessage, null);

string responseString = await response.Content.ReadAsStringAsync();
Assert.IsTrue(response.IsSuccessStatusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FunctionApp\FunctionApp.csproj">
<ProjectReference Include="..\FunctionAppNETFramework\FunctionAppNETFramework.csproj">
<Project>{0db6af7a-dd09-4412-ad46-ce6178d01f51}</Project>
<Name>FunctionApp</Name>
<Name>FunctionAppNETFramework</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Hosting;
using FunctionApp;
using FunctionAppNETFramework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject2
Expand All @@ -11,15 +11,15 @@ namespace UnitTestProject2
public class UnitTest1
{
[TestMethod]
public async Task NewProjectSystem_MsTest()
public async Task NewProjectSystem_MsTest_NETFx()
{
var requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://functions.azurewebsites.net?name=test")
{
Content = new StringContent(""),
Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } }
};

var response = await HttpTriggerCSharp.Run(requestMessage , null);
var response = await HttpTriggerNETFramework.Run(requestMessage , null);

string responseString = await response.Content.ReadAsStringAsync();
Assert.IsTrue(response.IsSuccessStatusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="[9.0.1]" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FunctionApp\FunctionApp.csproj" />
<ProjectReference Include="..\FunctionAppNETFramework\FunctionAppNETFramework.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Hosting;
using FunctionApp;
using FunctionAppNETFramework;
using Xunit;

namespace XUnitTestProject1
{
public class NetProjectSystem_XunitTest
{
[Fact]
public async Task XUnitTest()
public async Task XUnitTest_NETFx()
{
var requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://functions.azurewebsites.net?name=test")
{
Content = new StringContent(""),
Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } }
};

var response = await HttpTriggerCSharp.Run(requestMessage, null);
var response = await HttpTriggerNETFramework.Run(requestMessage, null);

string responseString = await response.Content.ReadAsStringAsync();
Assert.True(response.IsSuccessStatusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="[9.0.1]" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FunctionApp\FunctionApp.csproj" />
<ProjectReference Include="..\FunctionAppNETFramework\FunctionAppNETFramework.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 1b28b41

Please sign in to comment.