Skip to content

Commit

Permalink
Update target frameworks to net472 and net60 (#537)
Browse files Browse the repository at this point in the history
* Set updated target frameworks

* Fix build
  • Loading branch information
robertcoltheart authored Dec 16, 2024
1 parent 31c854f commit 1e575ba
Show file tree
Hide file tree
Showing 33 changed files with 90 additions and 127 deletions.
20 changes: 20 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<RootNamespace>Machine.Specifications</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<Authors>Machine Specifications</Authors>
<PackageTags>test;unit;testing;context;specification;bdd;tdd;mspec</PackageTags>
<PackageReleaseNotes>https://github.com/machine/machine.specifications/releases</PackageReleaseNotes>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>http://github.com/machine/machine.specifications</PackageProjectUrl>
<RepositoryUrl>http://github.com/machine/machine.specifications</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<None Include="../../images/icon.png" Pack="true" PackagePath="" Visible="false" />
</ItemGroup>
</Project>
6 changes: 0 additions & 6 deletions Machine.Specifications.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications.Shou
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications.Core", "src\Machine.Specifications.Core\Machine.Specifications.Core.csproj", "{12F8A086-25B8-4636-8520-5985CA56CB01}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications.Interfaces", "src\Machine.Specifications.Interfaces\Machine.Specifications.Interfaces.csproj", "{5A18854E-1B66-409F-8122-3E12A13B9F43}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications.Core.Specs", "src\Machine.Specifications.Core.Specs\Machine.Specifications.Core.Specs.csproj", "{0370391F-C7F2-41E7-BBC2-3D966F6F9ED9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Machine.Specifications.Fixtures", "src\Machine.Specifications.Fixtures\Machine.Specifications.Fixtures.csproj", "{2934AB5B-7506-4150-B61B-FE16EBB13D50}"
Expand Down Expand Up @@ -59,10 +57,6 @@ Global
{12F8A086-25B8-4636-8520-5985CA56CB01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12F8A086-25B8-4636-8520-5985CA56CB01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12F8A086-25B8-4636-8520-5985CA56CB01}.Release|Any CPU.Build.0 = Release|Any CPU
{5A18854E-1B66-409F-8122-3E12A13B9F43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A18854E-1B66-409F-8122-3E12A13B9F43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A18854E-1B66-409F-8122-3E12A13B9F43}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A18854E-1B66-409F-8122-3E12A13B9F43}.Release|Any CPU.Build.0 = Release|Any CPU
{0370391F-C7F2-41E7-BBC2-3D966F6F9ED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0370391F-C7F2-41E7-BBC2-3D966F6F9ED9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0370391F-C7F2-41E7-BBC2-3D966F6F9ED9}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
8 changes: 4 additions & 4 deletions build/build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bullseye" Version="4.2.1" />
<PackageReference Include="SimpleExec" Version="11.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.2" />
<PackageReference Include="Bullseye" Version="5.0.0" />
<PackageReference Include="SimpleExec" Version="12.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<DevelopmentDependency>true</DevelopmentDependency>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>

<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackageItems</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<PropertyGroup>
<Description>Roslyn analyzers and code fixes for Machine.Specifications</Description>
<Authors>Machine Specifications</Authors>
<PackageTags>mspec;test;unit;testing;context;specification;bdd;tdd;analyzers;roslyn</PackageTags>
<PackageReleaseNotes>See https://github.com/machine/machine.specifications.analyzers/releases</PackageReleaseNotes>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/machine/machine.specifications</PackageProjectUrl>
<RepositoryUrl>https://github.com/machine/machine.specifications.analyzers</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<None Include="../../images/icon.png" Pack="true" PackagePath="" Visible="false" />
<None Update="*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath="tools" Visible="false" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/ExceptionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Machine.Specifications
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class ExceptionResult
Expand Down
21 changes: 4 additions & 17 deletions src/Machine.Specifications.Core/Machine.Specifications.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<RootNamespace>Machine.Specifications</RootNamespace>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<AssemblyName>Machine.Specifications</AssemblyName>

<PackageId>Machine.Specifications.Core</PackageId>
</PropertyGroup>

<PropertyGroup>
<Description>Machine.Specifications is a Context/Specification framework geared towards removing language noise and simplifying tests</Description>
<Authors>Machine Specifications</Authors>
<PackageTags>test;unit;testing;context;specification;bdd;tdd;mspec</PackageTags>
<PackageReleaseNotes>https://github.com/machine/machine.specifications/releases</PackageReleaseNotes>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>http://github.com/machine/machine.specifications</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Machine.Specifications.Interfaces\Machine.Specifications.Interfaces.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="../../images/icon.png" Pack="true" PackagePath="" Visible="false" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Machine.Specifications
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class Result
Expand Down
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/Runner/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Machine.Specifications.Runner
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class AssemblyInfo : IEquatable<AssemblyInfo>
Expand Down
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/Runner/CapturedOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Machine.Specifications.Runner
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class CapturedOutput
Expand Down
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/Runner/ContextInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Machine.Specifications.Runner
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class ContextInfo : IEquatable<ContextInfo>
Expand Down
10 changes: 5 additions & 5 deletions src/Machine.Specifications.Core/Runner/Impl/DefaultRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
#endif
Expand All @@ -16,11 +16,11 @@

namespace Machine.Specifications.Runner.Impl
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class DefaultRunner :
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
MarshalByRefObject, IMessageSink,
#endif
ISpecificationRunner
Expand All @@ -40,7 +40,7 @@ public class DefaultRunner :

private bool explicitStartAndEnd;

#if !NETSTANDARD
#if !NET6_0_OR_GREATER
public DefaultRunner(object listener, string runOptionsXml, bool signalRunStartAndEnd)
: this(new RemoteRunListenerDecorator(listener), RunOptions.Parse(runOptionsXml), signalRunStartAndEnd)
{
Expand Down Expand Up @@ -173,7 +173,7 @@ public void EndRun(Assembly assembly)
runEnd.Invoke();
}

#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[SecurityCritical]
public override object InitializeLifetimeService()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override Encoding Encoding

if (first == null)
{
#if NETSTANDARD
#if NET6_0_OR_GREATER
return Encoding.UTF8;
#else

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
using System;
using System.Security;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/Runner/RunOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Machine.Specifications.Runner
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class RunOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Machine.Specifications.Runner
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class SpecificationInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD
#if !NET6_0_OR_GREATER

using System;
using System.Collections;
Expand Down
2 changes: 1 addition & 1 deletion src/Machine.Specifications.Core/Sdk/RunSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD
#if !NET6_0_OR_GREATER

using System.Collections.Generic;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Machine.Specifications
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
[Serializable]
#endif
public class SpecificationUsageException : Exception
Expand All @@ -22,7 +22,7 @@ public SpecificationUsageException(string message, Exception inner)
{
}

#if !NETSTANDARD
#if !NET6_0_OR_GREATER
protected SpecificationUsageException(
SerializationInfo info,
StreamingContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Machine.Specifications.Utility
{
internal static class ReflectionCompatExtensions
{
#if NETSTANDARD
#if NET6_0_OR_GREATER
public static bool IsType(this MemberInfo memberInfo)
{
return memberInfo is TypeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Machine.Specifications" Version="1.0.0" />
<PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.9.0" />
<PackageReference Include="Machine.Specifications.Should" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Machine.Specifications.Core\Machine.Specifications.Core.csproj" />
<ProjectReference Include="..\Machine.Specifications.Fakes\Machine.Specifications.Fakes.csproj" />
<ProjectReference Include="..\Machine.Specifications.Should\Machine.Specifications.Should.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
22 changes: 14 additions & 8 deletions src/Machine.Specifications.Runner.Utility/AppDomainRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
using System.Runtime.Remoting.Messaging;
#endif
using System.Security;
Expand Down Expand Up @@ -123,7 +123,7 @@ private static void UnloadAppDomain(AppDomain appDomain)
return;
}

#if !NETSTANDARD
#if !NET6_0_OR_GREATER
var cachePath = appDomain.SetupInformation.CachePath;

try
Expand All @@ -145,7 +145,7 @@ private static void UnloadAppDomain(AppDomain appDomain)
[SecuritySafeCritical]
private ISpecificationRunner CreateRunnerInSeparateAppDomain(AppDomain appDomain, AssemblyPath assembly)
{
#if !NETSTANDARD
#if !NET6_0_OR_GREATER
var path = Path.GetDirectoryName(assembly);

if (path == null)
Expand All @@ -155,12 +155,17 @@ private ISpecificationRunner CreateRunnerInSeparateAppDomain(AppDomain appDomain

var mspecAssemblyFilename = Path.Combine(path, "Machine.Specifications.dll");

if (!File.Exists(mspecAssemblyFilename))
AssemblyName mspecAssemblyName = null;

if (File.Exists(mspecAssemblyFilename))
{
return new NullSpecificationRunner();
mspecAssemblyName = AssemblyName.GetAssemblyName(mspecAssemblyFilename);
}

var mspecAssemblyName = AssemblyName.GetAssemblyName(mspecAssemblyFilename);
if (mspecAssemblyName == null)
{
return new NullSpecificationRunner();
}

var constructorArgs = new object[3];
constructorArgs[0] = listener;
Expand Down Expand Up @@ -188,7 +193,8 @@ private ISpecificationRunner CreateRunnerInSeparateAppDomain(AppDomain appDomain
throw;
}
#else
var runnerType = Type.GetType($"{RunnerType}, Machine.Specifications");
var runnerType = Type.GetType($"{RunnerType}, Machine.Specifications") ??
Type.GetType($"{RunnerType}, Machine.Specifications.Core");

if (runnerType == null)
{
Expand Down Expand Up @@ -217,7 +223,7 @@ private AppDomainAndRunner GetOrCreateAppDomainRunner(AssemblyPath assembly)
return appDomainAndRunner;
}

#if !NETSTANDARD
#if !NET6_0_OR_GREATER
var setup = new AppDomainSetup
{
ApplicationBase = Path.GetDirectoryName(assembly),
Expand Down
Loading

0 comments on commit 1e575ba

Please sign in to comment.