Skip to content

Commit

Permalink
Fixed #32 by addressing conditional compilation. Upgraded NuGet packa…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
lextm committed Apr 1, 2017
1 parent a48b86e commit de7ac2a
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 54 deletions.
15 changes: 1 addition & 14 deletions .nuget/Lextm.SharpSnmpLib.nuspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<version>9.0.8</version>
<version>9.1.0</version>
<authors>Malcolm Crowe,Lex Li,and other contributors.</authors>
<owners>Lex Li</owners>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
Expand All @@ -21,9 +21,6 @@
<tags>snmp</tags>
<dependencies>
<group targetFramework="net45" />
<group targetFramework="Xamarin.iOS10" />
<group targetFramework="Monoandroid" />
<group targetFramework="portable-net45+netcore45+MonoAndroid1+MonoTouch1" />
<group targetFramework="netstandard1.3">
<dependency id="NETStandard.Library" version="1.6.1" />
<dependency id="System.ComponentModel.TypeConverter" version="4.3.0" />
Expand All @@ -38,16 +35,6 @@
<file src="..\bin\SharpSnmpLib.Full.xml" target="lib\net45\SharpSnmpLib.Full.xml" />
<file src="..\bin\SharpSnmpLib.Portable.dll" target="lib\net45\SharpSnmpLib.Portable.dll" />
<file src="..\bin\SharpSnmpLib.Portable.xml" target="lib\net45\SharpSnmpLib.Portable.xml" />
<file src="..\bin\SharpSnmpLib.Portable.dll" target="lib\Xamarin.iOS10\SharpSnmpLib.Portable.dll" />
<file src="..\bin\SharpSnmpLib.Portable.xml" target="lib\Xamarin.iOS10\SharpSnmpLib.Portable.xml" />
<file src="..\bin\SharpSnmpLib.iOS.dll" target="lib\Xamarin.iOS10\SharpSnmpLib.iOS.dll" />
<file src="..\bin\SharpSnmpLib.Full.xml" target="lib\Xamarin.iOS10\SharpSnmpLib.iOS.xml" />
<file src="..\bin\SharpSnmpLib.Portable.dll" target="lib\Monoandroid\SharpSnmpLib.Portable.dll" />
<file src="..\bin\SharpSnmpLib.Android.dll" target="lib\Monoandroid\SharpSnmpLib.Android.dll" />
<file src="..\bin\SharpSnmpLib.Full.xml" target="lib\Monoandroid\SharpSnmpLib.Android.xml" />
<file src="..\bin\SharpSnmpLib.Portable.xml" target="lib\Monoandroid\SharpSnmpLib.Portable.xml" />
<file src="..\bin\SharpSnmpLib.Portable.dll" target="lib\portable-net45+netcore45+MonoAndroid1+MonoTouch1\SharpSnmpLib.Portable.dll" />
<file src="..\bin\SharpSnmpLib.Portable.xml" target="lib\portable-net45+netcore45+MonoAndroid1+MonoTouch1\SharpSnmpLib.Portable.xml" />
<file src="..\bin\SharpSnmpLib.NetStandard.dll" target="lib\netstandard1.3\SharpSnmpLib.NetStandard.dll" />
<file src="..\bin\SharpSnmpLib.NetStandard.xml" target="lib\netstandard1.3\SharpSnmpLib.NetStandard.xml" />
</files>
Expand Down
8 changes: 4 additions & 4 deletions SharpSnmpLib/Microsoft.VersionNumber.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
<!-- Properties for controlling the Assembly Version -->
<PropertyGroup>
<AssemblyMajorVersion>9</AssemblyMajorVersion>
<AssemblyMinorVersion>0</AssemblyMinorVersion>
<AssemblyMinorVersion>1</AssemblyMinorVersion>
<AssemblyBuildNumber>
</AssemblyBuildNumber>
<AssemblyRevision>
</AssemblyRevision>
<AssemblyBuildNumberType>DateString</AssemblyBuildNumberType>
<AssemblyBuildNumberFormat>04MMdd</AssemblyBuildNumberFormat>
<AssemblyBuildNumberFormat>00MMdd</AssemblyBuildNumberFormat>
<AssemblyRevisionType>AutoIncrement</AssemblyRevisionType>
<AssemblyRevisionFormat>00</AssemblyRevisionFormat>
</PropertyGroup>
<!-- Properties for controlling the Assembly File Version -->
<PropertyGroup>
<AssemblyFileMajorVersion>9</AssemblyFileMajorVersion>
<AssemblyFileMinorVersion>0</AssemblyFileMinorVersion>
<AssemblyFileMinorVersion>1</AssemblyFileMinorVersion>
<AssemblyFileBuildNumber>
</AssemblyFileBuildNumber>
<AssemblyFileRevision>
</AssemblyFileRevision>
<AssemblyFileBuildNumberType>DateString</AssemblyFileBuildNumberType>
<AssemblyFileBuildNumberFormat>04MMdd</AssemblyFileBuildNumberFormat>
<AssemblyFileBuildNumberFormat>00MMdd</AssemblyFileBuildNumberFormat>
<AssemblyFileRevisionType>AutoIncrement</AssemblyFileRevisionType>
<AssemblyFileRevisionFormat>00</AssemblyFileRevisionFormat>
</PropertyGroup>
Expand Down
18 changes: 14 additions & 4 deletions SharpSnmpLib/Pipeline/HandlerMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,26 @@ public HandlerMapping(string version, string command, string type, string assemb

private static IMessageHandler CreateMessageHandler(string assemblyName, string type)
{

#if NETSTANDARD
foreach (var assembly in from assembly in TypeResolver.GetAssemblies()
let name = assembly.GetName().Name
where string.Compare(name, assemblyName, StringComparison.OrdinalIgnoreCase) == 0
select assembly)
let name = assembly.GetName().Name
where string.Compare(name, assemblyName, StringComparison.OrdinalIgnoreCase) == 0
select assembly)
{
return (IMessageHandler)Activator.CreateInstance(assembly.GetType(type));
}
#if NETSTANDARD

return (IMessageHandler)Activator.CreateInstance(TypeResolver.Load(assemblyName, type));
#else
foreach (var assembly in from assembly in AppDomain.CurrentDomain.GetAssemblies()
let name = assembly.GetName().Name
where string.Compare(name, assemblyName, StringComparison.OrdinalIgnoreCase) == 0
select assembly)
{
return (IMessageHandler)Activator.CreateInstance(assembly.GetType(type));
}

return (IMessageHandler)Activator.CreateInstance(AppDomain.CurrentDomain.Load(assemblyName).GetType(type));
#endif
}
Expand Down
37 changes: 21 additions & 16 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -57,27 +57,32 @@
<HintPath>..\packages\JetBrains.dotMemoryUnit.2.3.20160517.113140\lib\dotMemory.Unit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.7.1.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.7.1\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="mscorlib" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="xunit.abstractions">
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
<Reference Include="xunit.assert, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop">
<HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
<Reference Include="xunit.core, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.dotnet, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.execution.2.2.0\lib\netstandard1.1\xunit.execution.dotnet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -213,7 +218,7 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- 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.
Expand Down
47 changes: 39 additions & 8 deletions Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,43 @@
<packages>
<package id="Castle.Core" version="4.0.0" targetFramework="net45" />
<package id="JetBrains.dotMemoryUnit" version="2.3.20160517.113140" targetFramework="net45" />
<package id="Moq" version="4.5.30" targetFramework="net45" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net45" />
<package id="Moq" version="4.7.1" targetFramework="net45" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net45" />
<package id="System.Collections" version="4.3.0" targetFramework="net45" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net45" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net45" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net45" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net45" />
<package id="System.Globalization" version="4.3.0" targetFramework="net45" />
<package id="System.IO" version="4.3.0" targetFramework="net45" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net45" />
<package id="System.Linq" version="4.3.0" targetFramework="net45" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net45" />
<package id="System.Net.Http" version="4.3.1" targetFramework="net45" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net45" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net45" />
<package id="System.Reflection" version="4.3.0" targetFramework="net45" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net45" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net45" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net45" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net45" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net45" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net45" />
<package id="System.Threading" version="4.3.0" targetFramework="net45" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net45" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net45" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net45" />
<package id="xunit" version="2.2.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.1" targetFramework="net45" />
<package id="xunit.assert" version="2.2.0" targetFramework="net45" />
<package id="xunit.core" version="2.2.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net45" developmentDependency="true" />
</packages>
2 changes: 1 addition & 1 deletion debug.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rmdir /S /Q bin
mkdir bin
rmdir /S /Q SharpSnmpLib\obj
rmdir /S /Q Tests\obj
.nuget\nuget.exe restore SharpSnmpLib.sln
.nuget\nuget.exe restore SharpSnmpLib.Classic.sln
call "%MSBuildExe%" SharpSnmpLib.Classic.sln /t:clean /p:Configuration=Debug /p:OutputPath=..\bin\
call "%MSBuildExe%" SharpSnmpLib.Classic.sln /t:build /p:Configuration=Debug /p:OutputPath=..\bin\
call dotnet restore SharpSnmpLib.NetStandard.sln
Expand Down
4 changes: 2 additions & 2 deletions lib/SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:

[assembly: AssemblyVersion("9.0.040308.00")]
[assembly: AssemblyFileVersion("9.0.040308.00")]
[assembly: AssemblyVersion("9.1.000401.01")]
[assembly: AssemblyFileVersion("9.1.000401.01")]
4 changes: 2 additions & 2 deletions lib/SharedAssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Imports System.Reflection
' You can specify all values by your own or you can build default build and revision
' numbers with the '*' character (the default):

<Assembly: AssemblyVersion("9.0.040308.00")>
<Assembly: AssemblyFileVersion("9.0.040308.00")>
<Assembly: AssemblyVersion("9.1.000401.01")>
<Assembly: AssemblyFileVersion("9.1.000401.01")>
2 changes: 1 addition & 1 deletion snmpd/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ActionListWinForms" version="1.3.0.0" targetFramework="net40" />
<package id="log4net" version="2.0.7" targetFramework="net45" />
<package id="log4net" version="2.0.8" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions snmpd/snmpd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
<None Include="Resources\network-server.ico" />
</ItemGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Office2007Renderer">
<HintPath>..\lib\Office2007Renderer.dll</HintPath>
Expand Down

0 comments on commit de7ac2a

Please sign in to comment.