Skip to content

Commit

Permalink
Merge pull request #1 from PKRoma/pk/vs2012
Browse files Browse the repository at this point in the history
Enable building with VS2010/.NET40 and fix NuGet restore
  • Loading branch information
Paul Betts committed May 12, 2013
2 parents 541bff6 + a86cad4 commit 82ebd0a
Show file tree
Hide file tree
Showing 168 changed files with 225 additions and 194,388 deletions.
6 changes: 6 additions & 0 deletions .nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
139 changes: 139 additions & 0 deletions .nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
<PackagesDir>$(SolutionDir)packages</PackagesDir>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>

<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<EnvKey ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
}
catch {
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
Binary file added .nuget/nuget.exe
Binary file not shown.
64 changes: 28 additions & 36 deletions ReactiveUI.Sample.Tests/ReactiveUI.Sample.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ReactiveUI.Sample.Tests</RootNamespace>
<AssemblyName>ReactiveUI.Sample.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -34,41 +36,34 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=1.7.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="FluentAssertions">
<HintPath>..\packages\FluentAssertions.1.7.1.1\Lib\net40\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\packages\reactiveui-xaml.3.0.1\lib\Net4\Microsoft.Practices.ServiceLocation.dll</HintPath>
<HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Reactive.Testing, Version=1.1.11111.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Rx-Compat_Unofficial.2.0.20304\lib\Net40\Microsoft.Reactive.Testing.dll</HintPath>
<Reference Include="Microsoft.Reactive.Testing">
<HintPath>..\packages\Rx_Experimental-Testing.1.1.11111\lib\Net4-Full\Microsoft.Reactive.Testing.dll</HintPath>
</Reference>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.4.5.1\lib\net40\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.0.8\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Ninject">
<HintPath>..\packages\Ninject.3.0.0.15\lib\net40\Ninject.dll</HintPath>
</Reference>
<Reference Include="Ninject.Extensions.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Ninject.Extensions.Logging">
<HintPath>..\packages\Ninject.Extensions.Logging.3.0.0.7\lib\net40\Ninject.Extensions.Logging.dll</HintPath>
</Reference>
<Reference Include="Ninject.Extensions.Logging.NLog2, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Ninject.Extensions.Logging.NLog2">
<HintPath>..\packages\Ninject.Extensions.Logging.nlog2.3.0.0.7\lib\net40\Ninject.Extensions.Logging.NLog2.dll</HintPath>
</Reference>
<Reference Include="Ninject.MockingKernel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Ninject.MockingKernel">
<HintPath>..\packages\Ninject.MockingKernel.3.0.0.5\lib\net40-full\Ninject.MockingKernel.dll</HintPath>
</Reference>
<Reference Include="Ninject.MockingKernel.Moq, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Ninject.MockingKernel.Moq">
<HintPath>..\packages\Ninject.MockingKernel.Moq.3.0.0.5\lib\net40-full\Ninject.MockingKernel.Moq.dll</HintPath>
</Reference>
<Reference Include="NLog">
Expand All @@ -77,36 +72,33 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="ReactiveUI">
<HintPath>..\packages\reactiveui-core.3.0.1\lib\Net4\ReactiveUI.dll</HintPath>
<HintPath>..\packages\reactiveui-core.3.2.0\lib\Net4\ReactiveUI.dll</HintPath>
</Reference>
<Reference Include="ReactiveUI.Blend">
<HintPath>..\packages\reactiveui-xaml.3.0.1\lib\Net4\ReactiveUI.Blend.dll</HintPath>
<HintPath>..\packages\reactiveui-xaml.3.2.0\lib\Net4\ReactiveUI.Blend.dll</HintPath>
</Reference>
<Reference Include="ReactiveUI.Routing">
<HintPath>..\packages\reactiveui-xaml.3.0.1\lib\Net4\ReactiveUI.Routing.dll</HintPath>
<HintPath>..\packages\reactiveui-xaml.3.2.0\lib\Net4\ReactiveUI.Routing.dll</HintPath>
</Reference>
<Reference Include="ReactiveUI.Testing">
<HintPath>..\packages\reactiveui-testing.3.0.1\lib\Net4\ReactiveUI.Testing.dll</HintPath>
<HintPath>..\packages\reactiveui-testing.3.2.0\lib\Net4\ReactiveUI.Testing.dll</HintPath>
</Reference>
<Reference Include="ReactiveUI.Xaml">
<HintPath>..\packages\reactiveui-xaml.3.0.1\lib\Net4\ReactiveUI.Xaml.dll</HintPath>
<HintPath>..\packages\reactiveui-xaml.3.2.0\lib\Net4\ReactiveUI.Xaml.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=102.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="RestSharp">
<HintPath>..\packages\RestSharp.102.7\lib\net35\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Reactive.Core">
<HintPath>..\packages\Rx-Compat_Unofficial.2.0.20304\lib\Net40\System.Reactive.Core.dll</HintPath>
<Reference Include="System.Reactive">
<HintPath>..\packages\Rx_Experimental-Main.1.1.11111\lib\Net4\System.Reactive.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Interfaces">
<HintPath>..\packages\Rx-Compat_Unofficial.2.0.20304\lib\Net40\System.Reactive.Interfaces.dll</HintPath>
<Reference Include="System.Reactive.Providers">
<HintPath>..\packages\Rx_Experimental-Providers.1.1.11111\lib\Net4\System.Reactive.Providers.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Linq">
<HintPath>..\packages\Rx-Compat_Unofficial.2.0.20304\lib\Net40\System.Reactive.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.PlatformServices">
<HintPath>..\packages\Rx-Compat_Unofficial.2.0.20304\lib\Net40\System.Reactive.PlatformServices.dll</HintPath>
<Reference Include="System.Reactive.Windows.Threading">
<HintPath>..\packages\Rx_Experimental-Xaml.1.1.11111\lib\Net4\System.Reactive.Windows.Threading.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -129,7 +121,6 @@
<Compile Include="ViewModels\RepoSelectionViewModelTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
Expand All @@ -140,11 +131,12 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
5 changes: 3 additions & 2 deletions ReactiveUI.Sample.Tests/ViewModels/AppViewModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Ninject.MockingKernel.Moq;
using Xunit;
using ReactiveUI.Sample.ViewModels;
using ReactiveUI.Routing;

namespace ReactiveUI.Sample.ViewModels.Tests
{
Expand All @@ -28,7 +29,7 @@ public void LoginScenarioRoutingTest()

// Our app starts on the Login page by default
this.Log().Info("Current Route: {0}", fixture.Router.GetUrlForCurrentRoute());
var loginModel = fixture.Router.CurrentViewModel.First() as ILoginViewModel;
var loginModel = fixture.Router.GetCurrentViewModel() as ILoginViewModel;
loginModel.Should().NotBeNull();

// Put in a fake user/pass and hit the Ok button
Expand All @@ -38,7 +39,7 @@ public void LoginScenarioRoutingTest()

// Make sure we're now showing the repo page
this.Log().Info("Current Route: {0}", fixture.Router.GetUrlForCurrentRoute());
(fixture.Router.CurrentViewModel.First() is IRepoSelectionViewModel).Should().BeTrue();
(fixture.Router.GetCurrentViewModel() is IRepoSelectionViewModel).Should().BeTrue();
}
}
}
18 changes: 0 additions & 18 deletions ReactiveUI.Sample.Tests/app.config

This file was deleted.

12 changes: 10 additions & 2 deletions ReactiveUI.Sample.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.0" />
<package id="FluentAssertions" version="1.7.1.1" />
<package id="Moq" version="4.0.10827" />
<package id="Newtonsoft.Json" version="4.5.1" />
<package id="Newtonsoft.Json" version="4.0.8" />
<package id="Ninject" version="3.0.0.15" />
<package id="Ninject.Extensions.Logging" version="3.0.0.7" />
<package id="Ninject.Extensions.Logging.nlog2" version="3.0.0.7" />
<package id="Ninject.MockingKernel" version="3.0.0.5" />
<package id="Ninject.MockingKernel.Moq" version="3.0.0.5" />
<package id="NLog" version="2.0.0.2000" />
<package id="reactiveui-core" version="3.2.0" />
<package id="reactiveui-testing" version="3.2.0" />
<package id="reactiveui-xaml" version="3.2.0" />
<package id="RestSharp" version="102.7" />
<package id="Rx_Experimental-Main" version="1.1.11111" />
<package id="Rx_Experimental-Providers" version="1.1.11111" />
<package id="Rx_Experimental-Testing" version="1.1.11111" />
<package id="Rx_Experimental-Xaml" version="1.1.11111" />
<package id="xunit" version="1.9.0.1566" />
<package id="xunit.extensions" version="1.9.0.1566" />
</packages>
</packages>
7 changes: 7 additions & 0 deletions ReactiveUI.Sample.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Sample", "Reacti
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Sample.Tests", "ReactiveUI.Sample.Tests\ReactiveUI.Sample.Tests.csproj", "{66228ACF-D185-406F-8731-D37E01E37254}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9D4603A8-DA78-40C3-9FE9-D9E782A6CF50}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\nuget.exe = .nuget\nuget.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Loading

0 comments on commit 82ebd0a

Please sign in to comment.