Skip to content

Commit

Permalink
Refactor ASP.NET msbuild
Browse files Browse the repository at this point in the history
Get rid of the outdated nuget.targets and replace it with a custom build file
  • Loading branch information
pdonald committed Dec 23, 2014
1 parent 197d492 commit 85169bc
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 164 deletions.
5 changes: 1 addition & 4 deletions frameworks/CSharp/aspnet/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
*.suo
*/bin/*
*/obj/*
lib/*
!lib/.nuget
lib/.nuget/NuGet.exe
!lib/packages.config
*/packages/*
nginx.upstream.conf
2 changes: 0 additions & 2 deletions frameworks/CSharp/aspnet/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

fw_depends nginx mono xsp

wget -q -N http://nuget.org/nuget.exe -O ${TROOT}/lib/.nuget/NuGet.exe
135 changes: 0 additions & 135 deletions frameworks/CSharp/aspnet/lib/.nuget/NuGet.targets

This file was deleted.

10 changes: 5 additions & 5 deletions frameworks/CSharp/aspnet/setup_nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export PATH=$MONO_HOME/bin:$PATH

sed -i 's|localhost|'"$DBHOST"'|g' src/Web.config

# build
cd src
rm -rf bin obj
xbuild Benchmarks.sln /p:Configuration=Release
cd ..
# extra cleaning
sudo rm -rf src/bin src/obj /tmp/nuget

xbuild src/Benchmarks.build.proj /t:Clean
xbuild src/Benchmarks.build.proj /t:Build

# nginx
conf="upstream mono {\n"
Expand Down
56 changes: 56 additions & 0 deletions frameworks/CSharp/aspnet/src/Benchmarks.build.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
<NuGetExe Condition=" '$(NuGetExe)'=='' ">packages/nuget.exe</NuGetExe>
<NuGetExeDir>packages/</NuGetExeDir>
<NuGetDownloadAddress Condition=" '$(NuGetDownloadAddress)'=='' ">http://nuget.org/nuget.exe</NuGetDownloadAddress>
<NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' == 'Windows_NT'">"$(NuGetExe)"</NuGetCommand>
<NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExe)"</NuGetCommand>
<Properties>Configuration=$(Configuration);SolutionDir=$(SolutionDir)</Properties>
</PropertyGroup>

<ItemGroup>
<Solution Include="*.sln" />
</ItemGroup>

<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" Condition=" '$(OS)' == 'Windows_NT' ">
<ParameterGroup>
<Address ParameterType="System.String" Required="true"/>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
new System.Net.WebClient().DownloadFile(Address, OutputFilename);
]]>
</Code>
</Task>
</UsingTask>

<Target Name="DownloadNuGet">
<MakeDir Directories="$(NuGetExeDir)" Condition=" !Exists('$(NuGetExeDir)') " />
<DownloadFile Address="$(NuGetDownloadAddress)" OutputFilename="$(NuGetExe)" Condition=" '$(OS)' == 'Windows_NT' AND !Exists('$(NuGetExe)')" />
<Exec Command="wget $(NuGetDownloadAddress) -O $(NuGetExe)" Condition=" '$(OS)' != 'Windows_NT' AND !Exists('$(NuGetExe)') " />
</Target>

<Target Name="RestorePackages" DependsOnTargets="DownloadNuGet">
<Exec Command="$(NuGetCommand) restore &quot;%(Solution.Identity)&quot;" />
</Target>

<Target Name="Clean">
<MSBuild Targets="Clean" Projects="@(Solution)" Properties="$(Properties)" />
</Target>

<Target Name="Build" DependsOnTargets="RestorePackages">
<MSBuild Targets="Build" Projects="@(Solution)" Properties="$(Properties)" />
</Target>

<Target Name="Rebuild" DependsOnTargets="RestorePackages">
<MSBuild Targets="Rebuild" Projects="@(Solution)" Properties="$(Properties)" />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,61 +45,61 @@
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Mvc">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\lib\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text">
<HintPath>..\lib\ServiceStack.Text.4.0.34\lib\net40\ServiceStack.Text.dll</HintPath>
<HintPath>$(SolutionDir)\packages\ServiceStack.Text.4.0.34\lib\net40\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="EntityFramework">
<Private>True</Private>
<HintPath>..\lib\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
<HintPath>$(SolutionDir)\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework">
<Private>True</Private>
<HintPath>..\lib\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<HintPath>$(SolutionDir)\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="MySql">
<Private>True</Private>
<HintPath>..\lib\MySql.Data.6.9.5\lib\net45\MySql.Data.dll</HintPath>
<HintPath>$(SolutionDir)\packages\MySql.Data.6.9.5\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql">
<Private>True</Private>
<HintPath>..\lib\MySql.Data.Entity.6.9.5\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
<HintPath>$(SolutionDir)\packages\MySql.Data.Entity.6.9.5\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="Npgsql">
<Private>True</Private>
<HintPath>..\lib\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
</Reference>
<Reference Include="Npgsql">
<Private>True</Private>
<HintPath>..\lib\Npgsql.EntityFramework.2.2.3\lib\net45\Npgsql.EntityFramework.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Npgsql.EntityFramework.2.2.3\lib\net45\Npgsql.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Npgsql">
<Private>True</Private>
<HintPath>..\lib\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="MongoDB">
<Private>True</Private>
<HintPath>..\lib\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Bson.dll</HintPath>
<HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB">
<Private>True</Private>
<HintPath>..\lib\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Driver.dll</HintPath>
<HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Driver.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -129,6 +129,11 @@
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\IIS.pubxml" />
</ItemGroup>
Expand All @@ -139,8 +144,7 @@
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != '' And Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')" />
<Import Project="..\lib\MSBuild.Microsoft.VisualStudio.Web.targets.11.0.2.1\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets" Condition="('$(VSToolsPath)' == '' Or !Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')) And Exists('..\lib\MSBuild.Microsoft.VisualStudio.Web.targets.11.0.2.1\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets')" />
<Import Project="..\lib\.nuget\NuGet.targets" Condition="Exists('..\lib\.nuget\NuGet.targets')" />
<Import Project="$(SolutionDir)\packages\MSBuild.Microsoft.VisualStudio.Web.targets.11.0.2.1\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets" Condition="('$(VSToolsPath)' == '' Or !Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')) And Exists('$(SolutionDir)\packages\MSBuild.Microsoft.VisualStudio.Web.targets.11.0.2.1\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets')" />
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)' == 'true'">
<AspNetCompiler VirtualPath="/" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
Expand Down
2 changes: 1 addition & 1 deletion frameworks/CSharp/aspnet/src/Benchmarks.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks.AspNet", "Benchmarks.AspNet.csproj", "{62C3DEA2-2696-4200-BD83-011679316847}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Benchmarks.csproj", "{62C3DEA2-2696-4200-BD83-011679316847}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down

0 comments on commit 85169bc

Please sign in to comment.