Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 7d105ae

Browse files
committed
Upgrade all test projects to net46 and NUnit 3.9.0
1 parent ca2665a commit 7d105ae

File tree

28 files changed

+258
-45
lines changed

28 files changed

+258
-45
lines changed

src/ServiceStack.OrmLite.MySql.Tests/ServiceStack.OrmLite.MySql.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;netcoreapp2.0</TargetFrameworks>
4+
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
55
<DebugType>portable</DebugType>
66
<AssemblyName>ServiceStack.OrmLite.MySql.Tests</AssemblyName>
77
<OutputType>Library</OutputType>
@@ -56,14 +56,14 @@
5656
</ItemGroup>
5757

5858
<ItemGroup>
59-
<PackageReference Include="NUnit" Version="3.8.1" />
59+
<PackageReference Include="NUnit" Version="3.9.0" />
6060
</ItemGroup>
6161

62-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
62+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
6363
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
6464
</PropertyGroup>
6565

66-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
66+
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
6767
<Reference Include="System.Configuration" />
6868
<Reference Include="System.Threading" />
6969
<Reference Include="System.Threading.Tasks" />

src/ServiceStack.OrmLite.MySql.Tests/ServiceStack.OrmLite.MySqlConnector.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;netcoreapp2.0</TargetFrameworks>
4+
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
55
<DebugType>portable</DebugType>
66
<AssemblyName>ServiceStack.OrmLite.MySql.Tests</AssemblyName>
77
<OutputType>Library</OutputType>
@@ -56,18 +56,18 @@
5656
</ItemGroup>
5757

5858
<ItemGroup>
59-
<PackageReference Include="NUnit" Version="3.8.1" />
59+
<PackageReference Include="NUnit" Version="3.9.0" />
6060
</ItemGroup>
6161

6262
<PropertyGroup>
6363
<DefineConstants>$(DefineConstants);MYSQLCONNECTOR</DefineConstants>
6464
</PropertyGroup>
6565

66-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
66+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
6767
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
6868
</PropertyGroup>
6969

70-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
70+
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
7171
<Reference Include="System.Configuration" />
7272
<Reference Include="System.Threading" />
7373
<Reference Include="System.Threading.Tasks" />

src/ServiceStack.OrmLite.Oracle.Tests/ServiceStack.OrmLite.Oracle.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net45</TargetFramework>
4+
<TargetFramework>net46</TargetFramework>
55
<AssemblyName>ServiceStack.OrmLite.Oracle.Tests</AssemblyName>
66
<PackageId>ServiceStack.OrmLite.Oracle.Tests</PackageId>
77
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
@@ -13,15 +13,15 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="NUnit" Version="3.8.1" />
16+
<PackageReference Include="NUnit" Version="3.9.0" />
1717
<Reference Include="..\..\lib\net45\ServiceStack.Interfaces.dll" />
1818
</ItemGroup>
1919

20-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
20+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
2121
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
2222
</PropertyGroup>
2323

24-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
24+
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
2525
<Reference Include="System.Configuration" />
2626
<Reference Include="System.Threading" />
2727
<Reference Include="System.Threading.Tasks" />

src/ServiceStack.OrmLite.PostgreSQL.Tests/ServiceStack.OrmLite.PostgreSQL.Tests.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;netcoreapp2.0</TargetFrameworks>
5-
<!--<TargetFrameworks>netcoreapp1.1</TargetFrameworks>-->
4+
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
65
<DebugType>portable</DebugType>
76
<AssemblyName>ServiceStack.OrmLite.PostgreSQL.Tests</AssemblyName>
87
<OutputType>Library</OutputType>
@@ -24,15 +23,15 @@
2423
</ItemGroup>
2524

2625
<ItemGroup>
27-
<PackageReference Include="NUnit" Version="3.8.1" />
26+
<PackageReference Include="NUnit" Version="3.9.0" />
2827
<PackageReference Include="Npgsql" Version="3.2.5" />
2928
</ItemGroup>
3029

31-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
30+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
3231
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
3332
</PropertyGroup>
3433

35-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
34+
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
3635
<ProjectReference Include="..\..\src\ServiceStack.OrmLite.Oracle\ServiceStack.OrmLite.Oracle.csproj" />
3736
<ProjectReference Include="..\..\src\ServiceStack.OrmLite.Firebird\ServiceStack.OrmLite.Firebird.csproj" />
3837
<ProjectReference Include="..\..\src\ServiceStack.OrmLite.VistaDB\ServiceStack.OrmLite.VistaDB.csproj" />
@@ -67,7 +66,7 @@
6766
</PropertyGroup>
6867

6968
<ItemGroup Condition=" '$(NUNITLITE)' != '' ">
70-
<PackageReference Include="NUnitLite" Version="3.6.1" />
69+
<PackageReference Include="NUnitLite" Version="3.9.0" />
7170
</ItemGroup>
7271

7372
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">

src/ServiceStack.OrmLite.SqlServerTests/ServiceStack.OrmLite.SqlServerTests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net45</TargetFramework>
4+
<TargetFramework>net46</TargetFramework>
55
<AssemblyName>ServiceStack.OrmLite.SqlServerTests</AssemblyName>
66
<PackageId>ServiceStack.OrmLite.SqlServerTests</PackageId>
77
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
@@ -13,16 +13,16 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
17-
<PackageReference Include="NUnit" Version="3.8.1" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
17+
<PackageReference Include="NUnit" Version="3.9.0" />
1818
<Reference Include="..\..\lib\net45\ServiceStack.Interfaces.dll" />
1919
</ItemGroup>
2020

21-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
21+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
2222
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
2323
</PropertyGroup>
2424

25-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
25+
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
2626
<PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.314.76" />
2727
<Reference Include="System" />
2828
<Reference Include="System.Configuration" />

src/ServiceStack.OrmLite.VistaDB.Tests/ServiceStack.OrmLite.VistaDB.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45</TargetFrameworks>
4+
<TargetFrameworks>net46</TargetFrameworks>
55
<DebugType>portable</DebugType>
66
<AssemblyName>ServiceStack.OrmLite.VistaDB.Tests</AssemblyName>
77
<OutputType>Library</OutputType>
@@ -18,17 +18,17 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="NUnit" Version="3.6.1" />
21+
<PackageReference Include="NUnit" Version="3.9.0" />
2222
<ProjectReference Include="..\..\src\ServiceStack.OrmLite\ServiceStack.OrmLite.csproj" />
2323
<ProjectReference Include="..\..\src\ServiceStack.OrmLite.VistaDB\ServiceStack.OrmLite.VistaDB.csproj" />
2424
<Reference Include="..\..\lib\net45\ServiceStack.Interfaces.dll" />
2525
</ItemGroup>
2626

27-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
27+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
2828
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
2929
</PropertyGroup>
3030

31-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
31+
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
3232
<Reference Include="System.Configuration" />
3333
<Reference Include="System.Threading" />
3434
<Reference Include="System.Threading.Tasks" />
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.IO;
3+
using System.Runtime.InteropServices;
4+
5+
namespace SqlServerTypes
6+
{
7+
/// <summary>
8+
/// Utility methods related to CLR Types for SQL Server
9+
/// </summary>
10+
internal class Utilities
11+
{
12+
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
13+
private static extern IntPtr LoadLibrary(string libname);
14+
15+
/// <summary>
16+
/// Loads the required native assemblies for the current architecture (x86 or x64)
17+
/// </summary>
18+
/// <param name="rootApplicationPath">
19+
/// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications
20+
/// and AppDomain.CurrentDomain.BaseDirectory for desktop applications.
21+
/// </param>
22+
public static void LoadNativeAssemblies(string rootApplicationPath)
23+
{
24+
var nativeBinaryPath = IntPtr.Size > 4
25+
? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\")
26+
: Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\");
27+
28+
LoadNativeAssembly(nativeBinaryPath, "msvcr100.dll");
29+
LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial110.dll");
30+
}
31+
32+
private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName)
33+
{
34+
var path = Path.Combine(nativeBinaryPath, assemblyName);
35+
var ptr = LoadLibrary(path);
36+
if (ptr == IntPtr.Zero)
37+
{
38+
throw new Exception(string.Format(
39+
"Error loading {0} (ErrorCode: {1})",
40+
assemblyName,
41+
Marshal.GetLastWin32Error()));
42+
}
43+
}
44+
}
45+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<html lang="en-US">
2+
<head>
3+
<meta charset="utf-8" />
4+
<title>Microsoft.SqlServer.Types</title>
5+
<style>
6+
body {
7+
background: #fff;
8+
color: #505050;
9+
margin: 20px;
10+
}
11+
12+
#main {
13+
background: #efefef;
14+
padding: 5px 30px;
15+
}
16+
</style>
17+
</head>
18+
<body>
19+
<div id="main">
20+
<h1>Action required to load native assemblies</h1>
21+
<p>
22+
To deploy an application that uses spatial data types to a machine that does not have 'System CLR Types for SQL Server' installed you also need to deploy the native assembly SqlServerSpatial110.dll. Both x86 (32 bit) and x64 (64 bit) versions of this assembly have been added to your project under the SqlServerTypes\x86 and SqlServerTypes\x64 subdirectories. The native assembly msvcr100.dll is also included in case the C++ runtime is not installed.
23+
</p>
24+
<p>
25+
You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture).
26+
</p>
27+
<h2>ASP.NET applications</h2>
28+
<p>
29+
For ASP.NET applications, add the following line of code to the Application_Start method in Global.asax.cs:
30+
<pre> SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));</pre>
31+
</p>
32+
<h2>Desktop applications</h2>
33+
<p>
34+
For desktop applications, add the following line of code to run before any spatial operations are performed:
35+
<pre> SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);</pre>
36+
</p>
37+
</div>
38+
</body>
39+
</html>

0 commit comments

Comments
 (0)