Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Merge changes from TFS #1

Merged
merged 1 commit into from
Jan 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tests/src/managed/Compilation/Compilation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

class Program
{
static int Main(string[] args)
{
Console.WriteLine("Starting the test");
string codeFile = @"helloWorld.cs";

var sourceTree = new List<SyntaxTree>(){SyntaxFactory.ParseSyntaxTree(File.ReadAllText(codeFile))};

string mscorlibFile = Path.Combine(Environment.GetEnvironmentVariable("Core_root"), "mscorlib.dll");
Console.WriteLine("Using reference to: {0}", mscorlibFile);
var reference = new List<MetadataReference>(){ MetadataReference.CreateFromFile(mscorlibFile)};

var compilation = CSharpCompilation.Create("helloworld", sourceTree, reference);

Console.WriteLine("Test compiled");
var result = compilation.Emit(new FileStream("helloworld.exe", FileMode.Create));
if (!result.Success)
{
return -1;
}

return 100;
}
}
45 changes: 45 additions & 0 deletions tests/src/managed/Compilation/Compilation.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<AssemblyName>Compilation</AssemblyName>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{39DD9A75-2535-4EBD-94A4-C7DF7EF12CF5}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
<DefineConstants>$(DefineConstants);STATIC</DefineConstants>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
</PropertyGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="Compilation.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="HelloWorld.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
13 changes: 13 additions & 0 deletions tests/src/managed/Compilation/HelloWorld.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

using System;
class C
{
static int Main()
{
Console.WriteLine("Hello " + "world");
return 100;
}
}
29 changes: 29 additions & 0 deletions tests/src/managed/Compilation/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Console" version="4.0.0-beta-22405" />
<package id="System.Runtime" version="4.0.20-beta-22405" />
<package id="System.Collections" version="4.0.10-beta-22512" />
<package id="System.Collections.Concurrent" version="4.0.10-beta-22416" />
<package id="System.IO" version="4.0.10-beta-22412" />
<package id="System.IO.FileSystem" version="4.0.0-beta-22412" />
<package id="System.IO.FileSystem.Primitives" version="4.0.0-beta-22412" />
<package id="System.Text.Encoding" version="4.0.10-beta-22512" />
<package id="System.Threading" version="4.0.0-beta-22412" />
<package id="System.Threading.Tasks" version="4.0.10-beta-22412" />
<package id="System.Runtime.Handles" version="4.0.0-beta-22412" />
<package id="System.Threading.ThreadPool" version="4.0.10-beta-22416" />
<package id="System.Threading.Overlapped" version="4.0.0-beta-22416" />
<package id="System.Dynamic.Runtime" version="4.0.0-beta-22416" />
<package id="System.Threading.Tasks.Parallel" version="4.0.0-beta-22416" />
<package id="System.Runtime.Extensions" version="4.0.10-beta-22412" />

<package id="Microsoft.CodeAnalysis" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Common" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.VisualBasic" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0.0-beta2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.32-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.17-beta" targetFramework="net45" />
</packages>