Skip to content

Commit

Permalink
Merge pull request #152 from dsplaisted/netcorebuild
Browse files Browse the repository at this point in the history
Add build support for .NET Core
  • Loading branch information
dsplaisted committed Aug 17, 2015
2 parents b5c3c29 + 9f445ab commit 16ed627
Show file tree
Hide file tree
Showing 84 changed files with 10,393 additions and 105 deletions.
51 changes: 44 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
Expand All @@ -18,14 +22,16 @@ bld/
[Bb]in/
[Oo]bj/

# Roslyn cache directories
*.ide/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

#NUNIT
# NUNIT
*.VisualState.xml
TestResult.xml

Expand All @@ -34,6 +40,10 @@ TestResult.xml
[Rr]eleasePS/
dlldata.c

# DNX
#project.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
Expand Down Expand Up @@ -86,7 +96,7 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding addin-in
# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
Expand All @@ -98,6 +108,7 @@ _TeamCity*
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
Expand Down Expand Up @@ -136,7 +147,7 @@ publish/
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# If using the old MSBuild-Integrated Package Restore, uncomment this:
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config

# Windows Azure Build Output
Expand All @@ -146,9 +157,13 @@ csx/
# Windows Store app package directory
AppPackages/

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
Expand All @@ -158,6 +173,7 @@ ClientBin/
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# RIA/Silverlight projects
Generated_Code/
Expand All @@ -181,3 +197,24 @@ UpgradeLog*.htm

# Microsoft Fakes
FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Project-specific
ApiPort/
*.xlsx
7 changes: 7 additions & 0 deletions RunApiPort.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
setlocal

msbuild %~dp0src\MSBuild.sln /p:Configuration=Port-Progress

set ANALYSIS_PATH=%~dp0bin\Windows_NT\Port-Progress
%~dp0ApiPort\ApiPort.exe analyze -f %ANALYSIS_PATH%\Microsoft.Build.dll -f %ANALYSIS_PATH%\Microsoft.Build.Framework.dll -f %ANALYSIS_PATH%\Microsoft.Build.Tasks.Core.dll -f %ANALYSIS_PATH%\Microsoft.Build.Utilities.Core.dll -f %ANALYSIS_PATH%\MSBuild.exe --target "ASP.NET 5, Version=1.0"
56 changes: 53 additions & 3 deletions dir.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>


<!-- Compiler config -->
<PropertyGroup>
Expand Down Expand Up @@ -64,6 +62,58 @@
<DebugType Condition="'$(DebugType)' == ''">pdbonly</DebugType>
<DefineConstants>$(DefineConstants);TRACE;STANDALONEBUILD;MONO</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug-NetCore'">
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
<Optimize Condition="'$(Optimize)' == ''">false</Optimize>
<DebugType Condition="'$(DebugType)' == ''">full</DebugType>
<DefineConstants>$(DefineConstants);DEBUG;TRACE;STANDALONEBUILD</DefineConstants>
<NetCoreBuild>true</NetCoreBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release-NetCore'">
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
<DebugType Condition="'$(DebugType)' == ''">pdbonly</DebugType>
<DefineConstants>$(DefineConstants);TRACE;STANDALONEBUILD</DefineConstants>
<NetCoreBuild>true</NetCoreBuild>
</PropertyGroup>

<!-- This configuration builds against the full .NET Framework but with the compilation constants to compile against
the .NET Core surface area. This way we can build a binary to run ApiPort on to measure progress. -->
<PropertyGroup Condition="'$(Configuration)' == 'Port-Progress'">
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
<Optimize Condition="'$(Optimize)' == ''">false</Optimize>
<DebugType Condition="'$(DebugType)' == ''">full</DebugType>
<DefineConstants>$(DefineConstants);DEBUG;TRACE;STANDALONEBUILD</DefineConstants>
<NetCoreSurface>true</NetCoreSurface>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>

<!-- .NET Core build support -->
<PropertyGroup Condition="'$(NetCoreBuild)' != 'true'">
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(NetCoreBuild)' == 'true'">
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<NuGetTargetMoniker>DNXCore,Version=v5.0</NuGetTargetMoniker>
<BaseNuGetRuntimeIdentifier>win7</BaseNuGetRuntimeIdentifier>
<NetCoreSurface>true</NetCoreSurface>
</PropertyGroup>

<PropertyGroup Condition="'$(NetCoreSurface)' != 'true'">
<DefineConstants>$(DefineConstants);FEATURE_SECURITY_PERMISSIONS</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_BINARY_SERIALIZATION</DefineConstants>
<FeatureBinarySerialization>true</FeatureBinarySerialization>
<DefineConstants>$(DefineConstants);FEATURE_XAML_TYPES</DefineConstants>
<FeatureXamlTypes>true</FeatureXamlTypes>
<DefineConstants>$(DefineConstants);FEATURE_RESOURCE_EXPOSURE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CONSTRAINED_EXECUTION</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(NetCoreSurface)' == 'true'">

<!-- Indicates whether CultureInfo has setters for the CurrentCulture and CurrentUICulture properties.
If not, then the corresponding properties on Thread (which aren't in .NET Core) need to be used. -->
<DefineConstants>$(DefineConstants);FEATURE_CULTUREINFO_SETTERS</DefineConstants>
</PropertyGroup>

<!-- Setup some common paths -->
<PropertyGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/Framework/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
//-----------------------------------------------------------------------

using System.Reflection;
#if FEATURE_SECURITY_PERMISSIONS
using System.Security.Permissions;
#endif
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
#if FEATURE_XAML_TYPES
using System.Windows.Markup;
#endif

#if FEATURE_SECURITY_PERMISSIONS
// A combination of RequestMinimum and RequestOptional causes the permissions granted to
// the assembly to only be the permission requested (like a PermitOnly). More generally
// the equation for the PermissionSet granted at load time is:
Expand All @@ -32,6 +37,7 @@
#pragma warning disable 618
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]
#pragma warning restore 618
#endif
#if STANDALONEBUILD || MONO
[assembly: AssemblyVersion("14.1.0.0")]
[assembly: InternalsVisibleTo("Microsoft.Build.Framework.UnitTests")]
Expand All @@ -44,7 +50,9 @@
// tlbexp just pick whatever it wants.
[assembly: GuidAttribute("D8A9BA71-4724-481d-9CA7-0DA23A1D615C")]

#if FEATURE_XAML_TYPES
[assembly: XmlnsDefinition("http://schemas.microsoft.com/build/2009/properties", "Microsoft.Build.Framework.XamlTypes")]
#endif
#if !MONO
// This will enable passing the SafeDirectories flag to any P/Invoke calls/implementations within the assembly,
// so that we don't run into known security issues with loading libraries from unsafe locations
Expand Down
2 changes: 2 additions & 0 deletions src/Framework/BuildEngineResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace Microsoft.Build.Framework
/// <summary>
/// This structure is used to return the result of the build and the target outputs.
/// </summary>
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "Would require a public API change -- currently we're trying to keep our surface area static.")]
public struct BuildEngineResult
{
Expand Down
5 changes: 4 additions & 1 deletion src/Framework/BuildErrorEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace Microsoft.Build.Framework
/// without following certain special FX guidelines, can break both
/// forward and backward compatibility
/// </remarks>
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
public class BuildErrorEventArgs : LazyFormattedBuildEventArgs
{
/// <summary>
Expand Down Expand Up @@ -270,6 +272,7 @@ public int EndColumnNumber
}
}

#if FEATURE_BINARY_SERIALIZATION
#region CustomSerializationToStream
/// <summary>
/// Serializes to a stream through a binary writer
Expand Down Expand Up @@ -389,6 +392,6 @@ internal override void CreateFromStream(BinaryReader reader, int version)
_endColumnNumber = reader.ReadInt32();
}
#endregion

#endif
}
}
10 changes: 9 additions & 1 deletion src/Framework/BuildEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ namespace Microsoft.Build.Framework
/// without following certain special FX guidelines, can break both
/// forward and backward compatibility
/// </remarks>
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
public abstract class BuildEventArgs : EventArgs
{
/// <summary>
Expand Down Expand Up @@ -55,7 +57,9 @@ public abstract class BuildEventArgs : EventArgs
/// <summary>
/// Build event context
/// </summary>
#if FEATURE_BINARY_SERIALIZATION
[OptionalField(VersionAdded = 2)]
#endif
private BuildEventContext _buildEventContext;

/// <summary>
Expand Down Expand Up @@ -177,6 +181,7 @@ public BuildEventContext BuildEventContext
}
}

#if FEATURE_BINARY_SERIALIZATION
#region CustomSerializationToStream
/// <summary>
/// Serializes to a stream through a binary writer
Expand Down Expand Up @@ -316,8 +321,10 @@ internal virtual void CreateFromStream(BinaryReader reader, int version)
#endregion
}
#endregion
#region SetSerializationDefaults
#endif

#if FEATURE_BINARY_SERIALIZATION
#region SetSerializationDefaults
/// <summary>
/// Run before the object has been deserialized
/// UNDONE (Logging.) Can this and the next function go away, and instead return a BuildEventContext.Invalid from
Expand Down Expand Up @@ -349,5 +356,6 @@ private void SetBuildEventContextDefaultAfterSerialization(StreamingContext sc)
}
}
#endregion
#endif
}
}
2 changes: 2 additions & 0 deletions src/Framework/BuildEventContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace Microsoft.Build.Framework
/// Will provide location information for an event, this is especially
/// needed in a multi processor environment
/// </summary>
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
public class BuildEventContext
{
#region Data
Expand Down
5 changes: 4 additions & 1 deletion src/Framework/BuildFinishedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace Microsoft.Build.Framework
/// without following certain special FX guidelines, can break both
/// forward and backward compatibility
/// </remarks>
#if FEATURE_BINARY_SERIALIZATION
[Serializable]
#endif
public class BuildFinishedEventArgs : BuildStatusEventArgs
{
/// <summary>
Expand Down Expand Up @@ -96,7 +98,7 @@ params object[] messageArgs
}



#if FEATURE_BINARY_SERIALIZATION
#region CustomSerializationToStream
/// <summary>
/// Serializes to a stream through a binary writer
Expand All @@ -119,6 +121,7 @@ internal override void CreateFromStream(BinaryReader reader, int version)
_succeeded = reader.ReadBoolean();
}
#endregion
#endif
/// <summary>
/// Succeeded is true if the build succeeded; false otherwise.
/// </summary>
Expand Down
Loading

0 comments on commit 16ed627

Please sign in to comment.