Skip to content

Commit

Permalink
Merge pull request #220 from nunit/issue-216
Browse files Browse the repository at this point in the history
Fix compiling the .NET 2.0 version of Mock Assembly in VS2017
  • Loading branch information
CharliePoole committed May 10, 2017
2 parents 2534587 + f4d9d2e commit f743a8f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
17 changes: 17 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Note that assemblies in one layer must not reference those in any other layer, e
Developers should make sure not to introduce any other references.

There are two ways to build NUnit: using the solution file in an IDE or through the build script.
See also [Building and testing for Linux on a Windows machine](#building-and-testing-for-linux-on-a-windows-machine).

## Solution Build

Expand Down Expand Up @@ -61,3 +62,19 @@ For a full list of tasks, run `build.cmd -ShowDescription`.
you have to be very careful that the build is up to date before packaging.

2. For additional targets, refer to the build.cake script itself.

### Building and testing for Linux on a Windows machine

Most of the time, it's not necessary to build or run tests on platforms other than your primary
platform. The continuous integration which runs on every PR is enough to catch any problems.

Once in a while you may find it desirable to be primarily developing the repository on a Windows
machine but to run Linux tests on the same set of files while you edit them in Windows.
One convenient way to do this is to pass the same arguments to [build-mono-docker.ps1](.\build-mono-docker.ps1) that you would pass to build.ps1. It requires
[Docker](https://docs.docker.com/docker-for-windows/install/) to be installed.

For example, to build and test everything: `.\build-mono-docker.ps1 -t test`

This will run a temporary container using the latest
[Mono image](https://hub.docker.com/r/library/mono/), mounting the repo inside the container
and executing the [build.sh](build.sh) Cake bootstrapper with the arguments you specify.
2 changes: 1 addition & 1 deletion NUnit.Engine.Netstandard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.engine.tests.netstandard", "src\NUnitEngine\nunit.engine.tests.netstandard\nunit.engine.tests.netstandard.csproj", "{BC22F0E4-0862-4F82-A912-C9A447FECBAD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mock-assembly.netstandard", "src\NUnitEngine\mock-assembly\mock-assembly.netstandard.csproj", "{BC6C8155-2024-4F58-A006-18A15EA22A5C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mock-assembly.netstandard", "src\NUnitEngine\mock-assembly.netstandard\mock-assembly.netstandard.csproj", "{BC6C8155-2024-4F58-A006-18A15EA22A5C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.engine.netstandard", "src\NUnitEngine\nunit.engine.netstandard\nunit.engine.netstandard.csproj", "{C26FFC46-60CE-4CBA-87BD-8E9B972C0E0D}"
EndProject
Expand Down
7 changes: 7 additions & 0 deletions build-mono-docker.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
trap [Management.Automation.CommandNotFoundException] {
Write-Error 'Docker cannot be found. Make sure it is installed and added to the path.'
Start-Process -FilePath 'https://docs.docker.com/docker-for-windows/install/'
continue;
}

docker run --rm -it -v ${PSScriptRoot}:/nunit-console -w=/nunit-console mono:4.2.4 bash build.sh $args
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<ItemGroup>
<Compile Include="..\..\CommonAssemblyInfo.cs" Link="Properties\CommonAssemblyInfo.cs" />
<Compile Include="..\EngineVersion.cs" Link="Properties\EngineVersion.cs" />
<Compile Include="..\mock-assembly\Properties\AssemblyInfo.cs" Link="Properties\AssemblyInfo.cs" />
<Compile Include="..\mock-assembly\MockAssembly.cs" Link="MockAssembly.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\mock-assembly\mock-assembly.netstandard.csproj" />
<ProjectReference Include="..\mock-assembly.netstandard\mock-assembly.netstandard.csproj" />
<ProjectReference Include="..\nunit.engine.netstandard\nunit.engine.netstandard.csproj" />
</ItemGroup>

Expand Down

0 comments on commit f743a8f

Please sign in to comment.