Skip to content

Commit

Permalink
Upgrade to Visual Studio 2017 + csproj tooling (#406)
Browse files Browse the repository at this point in the history
* Upgrade to Visual Studio 2017 + csproj tooling

* Include workaround for NuGet/Home#4337 (explicitly specify version when restoring NuGet packages)

* Work around dotnet/cli-migrate#11

* Upgrade to .NET Core 1.1.x

* Remove VersionPrefix from all csproj files

* Legacy NuGet restore is no longer needed

* Disable CS1701 warning for sample projects

* Turns out we actually do need the legacy NuGet restore

* Use VS2017 AppVeyor image

* Remove project dependencies to work around NuGet/Home#5193 and NuGet/Home#4578

* Use MSBuild 15 on AppVeyor

* Enforce .NET Core tools 1.0.0 in global.json

* Use newer npm on AppVeyor (as a workaround for https://github.com/dotnet/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
  • Loading branch information
Daniel15 authored May 11, 2017
1 parent ae03dc7 commit 9bc1388
Show file tree
Hide file tree
Showing 48 changed files with 635 additions and 944 deletions.
8 changes: 5 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
version: '{build}'
os: Visual Studio 2015
os: Visual Studio 2017
install:
- set PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%PATH%
- set PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\;%PATH%
- ps: Install-Product node 6
- npm install --global npm
build:
project: build.proj
verbosity: normal
test_script:
- dotnet test --configuration Release --no-build tests/React.Tests
- dotnet test --configuration Release --no-build tests/React.Tests/React.Tests.csproj
artifacts:
- path: output\*.nupkg
37 changes: 15 additions & 22 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<Revision>0</Revision>
<DevNuGetServer>http://reactjs.net/packages/</DevNuGetServer>
<MSBuildCommunityTasksPath>$(MSBuildProjectDirectory)\tools\MSBuildTasks</MSBuildCommunityTasksPath>
<PackageOutputDir>output</PackageOutputDir>
<PackageOutputDir>$(MSBuildProjectDirectory)\output</PackageOutputDir>
<BuildType Condition="'$(BuildType)' == ''">Dev</BuildType>

<SolutionFile>src\React.sln</SolutionFile>
Expand All @@ -31,18 +31,18 @@ of patent rights can be found in the PATENTS file in the same directory.
<PackageAssemblies Include="System.Web.Optimization.React" />
</ItemGroup>

<Import Project="src/React.tasks.proj" />
<Target Name="RestorePackages" DependsOnTargets="Clean">
<!-- NuGet packages for .xproj projects -->
<Import Project="$(MSBuildProjectDirectory)\tools\MSBuildTasks\MSBuild.Community.Tasks.Targets" />

<Target Name="RestorePackages" DependsOnTargets="Clean;UpdateVersion">
<!-- NuGet packages for "legacy" projects (eg. React.Samples.Mvc4) -->
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dotnet restore"
Command="tools\NuGet\nuget.exe restore $(SolutionFile)"
/>
<!-- NuGet packages for "legacy" projects (eg. React.Samples.Mvc4) -->
<!-- NuGet packages for modern .csproj projects -->
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="tools\NuGet\nuget.exe restore $(SolutionFile)"
Command="dotnet restore $(SolutionFile) /p:Version=$(VersionString)"
/>
<!-- npm packages -->
<Exec
Expand All @@ -64,25 +64,18 @@ of patent rights can be found in the PATENTS file in the same directory.
</Time>
<!-- Prepend date to build version if a dev build-->
<PropertyGroup Condition="$(BuildType) == 'Release'">
<BuildSuffix></BuildSuffix>
<BuildWithSuffix>$(Build)</BuildWithSuffix>
<VersionString>$(Major).$(Minor).$(Build)</VersionString>
</PropertyGroup>
<PropertyGroup Condition="$(BuildType) != 'Release'">
<BuildSuffix>dev-$(Date)</BuildSuffix>
<BuildWithSuffix>$(Build)-$(BuildSuffix)</BuildWithSuffix>
<VersionString>$(Major).$(Minor).$(Build)-dev-$(Date)</VersionString>
</PropertyGroup>
<!-- Set version for assemblies -->
<AssemblyInfo
CodeLanguage="CS"
OutputFile="src\SharedAssemblyVersionInfo.cs"
AssemblyVersion="$(Major).$(Minor)"
AssemblyFileVersion="$(Major).$(Minor).$(BuildWithSuffix).$(Revision)"
AssemblyInformationalVersion="$(Major).$(Minor).$(BuildWithSuffix)"
/>
<!-- Ensure version numbers in project.json files are in sync -->
<UpdateAspNetProjectVersion
Files="src/%(PackageAssemblies.Identity)/project.json"
Version="$(Major).$(Minor).$(Build)-*"
AssemblyFileVersion="$(VersionString).$(Revision)"
AssemblyInformationalVersion="$(VersionString)"
/>
</Target>

Expand All @@ -97,14 +90,14 @@ of patent rights can be found in the PATENTS file in the same directory.

<Target Name="Build" DependsOnTargets="RestorePackages;UpdateVersion">
<Exec WorkingDirectory="src/React.Core" Command="node_modules/.bin/gulp" />
<MSBuild Projects="$(SolutionFile)" Targets="Rebuild" Properties="Configuration=Release;Platform=Any CPU;NoWarn=1607,7035" />
<MSBuild Projects="$(SolutionFile)" Targets="Rebuild" Properties="Configuration=Release;Platform=Any CPU;NoWarn=1607,7035,1701;Version=$(VersionString)" />
<Exec WorkingDirectory="src/React.Sample.Webpack" Command="node_modules/.bin/webpack" />
</Target>

<Target Name="Test" DependsOnTargets="Build">
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dotnet test --configuration Release --no-build tests/React.Tests"
Command="dotnet test --configuration Release --no-build tests/React.Tests/React.Tests.csproj"
/>
</Target>

Expand All @@ -116,7 +109,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<MakeDir Directories="$(PackageOutputDir)" />
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)"
Command="dotnet pack --output $(PackageOutputDir) --configuration Release --version-suffix $(BuildSuffix) --no-build src/%(PackageAssemblies.Identity)"
Command="dotnet pack --output $(PackageOutputDir) --configuration Release --no-build src/%(PackageAssemblies.Identity) /p:Version=$(VersionString)"
/>
</Target>

Expand Down
4 changes: 2 additions & 2 deletions dev-build-push.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" build.proj /t:Package;Push /p:BuildType=Dev
pause
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" build.proj /t:Package;Push /p:BuildType=Dev
pause
4 changes: 2 additions & 2 deletions dev-build.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" build.proj
pause
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" build.proj
pause
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "1.0.0-preview2-003121"
"version": "1.0.0"
},
"projects": [ "src", "test" ]
}
}
4 changes: 2 additions & 2 deletions release-build-push.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" build.proj /t:Package;Push /p:BuildType=Release
pause
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" build.proj /t:Package;Push /p:BuildType=Release
pause
4 changes: 2 additions & 2 deletions release-build.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" build.proj /p:BuildType=Release
pause
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" build.proj /p:BuildType=Release
pause
37 changes: 37 additions & 0 deletions src/Cassette.React/Cassette.React.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Allows you to transpile JavaScript via Babel using Cassette.</Description>
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
<AssemblyTitle>ReactJS.NET - Babel for Cassette</AssemblyTitle>
<Authors>Daniel Lo Nigro</Authors>
<TargetFramework>net40</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Cassette.React</AssemblyName>
<PackageId>Cassette.React</PackageId>
<PackageTags>asp.net;mvc;asp;jquery;javascript;js;react;facebook;reactjs;babel;cassette</PackageTags>
<PackageIconUrl>http://reactjs.net/img/logo_64.png</PackageIconUrl>
<PackageProjectUrl>http://reactjs.net/</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/reactjs/React.NET#licence</PackageLicenseUrl>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" />
<Compile Include="..\SharedAssemblyVersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\React.Core\React.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cassette" Version="2.4.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
19 changes: 0 additions & 19 deletions src/Cassette.React/Cassette.React.xproj

This file was deleted.

37 changes: 0 additions & 37 deletions src/Cassette.React/project.json

This file was deleted.

53 changes: 53 additions & 0 deletions src/React.AspNet/React.AspNet.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>ReactJS and Babel tools for ASP.NET Core, including ASP.NET Core MVC. Please refer to project site (http://reactjs.net/) for full installation instructions, usage examples and sample code</Description>
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
<AssemblyTitle>ReactJS.NET (ASP.NET Core MVC)</AssemblyTitle>
<Authors>Daniel Lo Nigro</Authors>
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>React.AspNet</AssemblyName>
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>React.AspNet</PackageId>
<PackageTags>asp.net;mvc;asp;javascript;js;react;facebook;reactjs;vnext;asp.net 5</PackageTags>
<PackageIconUrl>http://reactjs.net/img/logo_64.png</PackageIconUrl>
<PackageProjectUrl>http://reactjs.net/</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/reactjs/React.NET#licence</PackageLicenseUrl>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>$(DefineConstants);ASPNETCORE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" />
<Compile Include="..\SharedAssemblyVersionInfo.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\React.Core\React.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="1.1.1" />
</ItemGroup>

</Project>
19 changes: 0 additions & 19 deletions src/React.AspNet/React.AspNet.xproj

This file was deleted.

55 changes: 0 additions & 55 deletions src/React.AspNet/project.json

This file was deleted.

Loading

0 comments on commit 9bc1388

Please sign in to comment.