New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core support #197

Merged
merged 116 commits into from Aug 6, 2016

Conversation

Projects
None yet
@alexandrnikitin
Member

alexandrnikitin commented Aug 21, 2015

This is another option how to get .NET Core support for #192. I prefer this one more comparing to #193. Approach is borrowed from Automapper project.

  • Introduced Class Library (Package) project that targets .Net 4, 4.5 and Core which replaced original NSubstitute.csproj.
  • Introduced TypeExtensions under System.Reflection namespace that handles all work with types.
  • Included Castle.Core assembly compiled against .NET Core based on castleproject/Core#92
  • Tests projects are unloaded because cannot reference new Class Library (Package) type of project. To solve that we need to introduce separate old type projects like AutoMapper does.

TODO:

  • drop .Net 3.5 support?
  • add old type of class library project and enable tests against it
  • adjust FAKE build scripts to build new type of project
  • add ILMerge for .NET Core project (better to have it in build script)
  • publish alpha version of .NET Core support
  • TBA

Feedback is appreciated.

@alexandrnikitin

This comment has been minimized.

Member

alexandrnikitin commented Aug 1, 2016

@jirisykora83 Could you provide more details please. What type do you try to substitute?

@jasonwilliams200OK it isn't that easy unfortunately. I tried to express the current msbuild csproj via project.json sometime ago but failed. We have ILMerge and there were other pitfalls I don't remember of. The best (or only viable option) is to script that procedure via FAKE. There's a working version alexandrnikitin#8 It lacks xml docs for .NET Core and proper nuspec. But it works at least.
You can launch it via NSubstitute>Build Zip mode=Release targets=ALL and observe artifacts in NSubstitute\Output folder.

@jirisykora83

This comment has been minimized.

jirisykora83 commented Aug 2, 2016

@alexandrnikitin Sorry i don't know why it is mis in my post. I try substitute System.Net.HttpWebRequest

alexandrnikitin and others added some commits Aug 2, 2016

Added netstandard1.5 target to build
- Added netstandard1.5 as valid target
- Skipped NETCORE_TARGETS for tasks that are currently incompatible
  (such as tests/tests against docs)
- Documented build params in "-T" task
- Hacked around with FAKE target dependencies to try to selectively build
  NET/dotnetcore projects based on targets. Had to add "soft dependencies"
  on Clean and Version to make sure that, if they are being run, they do
  so prior to build. See [1].

[1]: http://fsharp.github.io/FAKE/soft-dependencies.html

@alexandrnikitin alexandrnikitin merged commit ac140ef into nsubstitute:master Aug 6, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

dtchepak added a commit that referenced this pull request Aug 7, 2016

Add CI scripts
(DT: Record of Peter's commits got lost while merging #197.
Cherry-picked one of many commits as a marker for these
contributions.)

dtchepak added a commit that referenced this pull request Aug 7, 2016

Add CI scripts
(DT: Record of Peter's commits got lost while merging #197.
Cherry-picked one of many commits as a marker for these
contributions.)
@dtchepak

This comment has been minimized.

Member

dtchepak commented Aug 7, 2016

Hi everyone,

This is all part of the 2.0.0.0-rc release. (It needs to be RC as we take a dependency on a pre-release Castle.Core.)

Thanks to everyone who participated with feedback and test results. Thanks especially to @alexandrnikitin, without whom this release would not have happened. Also thanks to @jasonwilliams200OK for his valuable contributions to the .net core code and CI builds.

Regards,
David

@alexandrnikitin alexandrnikitin deleted the alexandrnikitin:Issue192_NetCore_Project branch Nov 2, 2016

@dougajmcdonald

This comment has been minimized.

dougajmcdonald commented Nov 21, 2017

I'm trying to use the 2.0.0.rc or 2.0.1rc via nuget but both of them at the moment give me the following warning regarding Castle.Core:

warning NU1603: Castle.Core 4.0.0-beta001 depends on System.ComponentModel.TypeConverter (>= 4.0.1) but System.ComponentModel.TypeConverter 4.0.1 was not found. An approximate best match of System.ComponentModel.TypeConverter 4.1.0 was resolved

Is this to be expected? or is there a better version / rc to play with?

@alexandrnikitin

This comment has been minimized.

Member

alexandrnikitin commented Nov 21, 2017

@dougajmcdonald The latest stable version is 3.1.0. It targets .NET Standard 1.3 and has all fixes. Please try to use it.

@dougajmcdonald

This comment has been minimized.

dougajmcdonald commented Nov 21, 2017

@alexandrnikitin thanks for the pointer, I misread the dependencies in nuget. Compilation is all happy now

baralong added a commit to baralong/NSubstitute that referenced this pull request Feb 13, 2018

.NET Core support (nsubstitute#197)
* Remove original NSubstitute project

* Add dotnet core project

* Remove unnecessary meta info

* Add Castle.Core as dependency

* Move dependencies under dontnet core framework

* Upgrade packages versions

* Add TypeExtensions based on AutoMapper code

* TypeExtensions used

* Solve some reflection issues

* Solve SerializationInfo and StreamingContext issues

* Add Collections.Concurrent package

* Seems custom dll worked

* Add System.ServiceModel assembly

* ConvertAll fix

* Remove System.ServiceModel from Net Core

* Remove System.Security.Permissions from Net Core

* Adjust TypeExtensions class

* Not DNXCORE50 condition replaced with NET4 || NET45

* Add FAKEX package to build DNX projects

* Add bat script that installs dnvm and the latest runtime

* Add draft DNX specific targets

* Remove FAKEX tools

* Add NSubstitute.NET project based on original project file to be able to test the code

* Add TypeExtensions

* Define NET35 condition constant

* Copy ilmerge.exclude

* Tests projects are back ☺️

* Fixed exception serialization for NET35

* Security and Serialization for NET35

* Finish resolving conflicts

* Port changes from "main" csproj file

* Update to the latest coreclr version

* Hardcode VS version. MSBuild I love you soooo much!!!  🐮 🐮 🐮

* Update Runtime

* Remove unused csproj

* Exclude project.lock file

* Ignore project lock

* No Serializable in .NET Core

* Move .NET Core project to a separate solution file

* Resolve merge conflicts

* Change CoreCLR version to "stable" one

* No restore stage

* Remove not used csproj

* Build only

* Add Merge task

* Add a file from the previous merge to the new .NET proj file

* Add Castle.Core alpha version

* Disable AutoQueryableProvider so far

* Remove dll wrapper. It's not needed any more

* Bump version to 2.0.0-alpha. Add package details.

* Enable Task extensions for .NET Core

* AutoTaskProvider is there for .NET Core :hooray:

* Enable AutoObservableProvider for beloved .NET Core

* AutoQueryableProvider it is. Build works from Visual Studio but not from CLI. MS, I love you sooo f* much.

* No more dnx and dnvm. Long live dotnet cli. Please 🙏🙏🙏

* Dynamics in Core

* Bump the version

* Add a runner for the unit tests

* Add the Acceptance tests proj to .NET Core

* Fixing the build of the acceptance tests proj

* Better runner

* Yeah, the System.Diagnostics.TraceSource thing, of course

* Fix IsSubclassOf for .NET 🐮

* Fix dynamics for .NET Core

* Enable some tests for .NET Core

* Enable tests for .NET Core

* Bump the version to alpha003 💥

* Test runner

* Misc. fixes

* Fix reflection extensions

* Fixing the .NET 4 build

* Fix the .NET 3.5 build

* Build netstandard1.5 only

* Fix namespace

* No reason in Configuration. They handled via project.json

* Fix the build

* Revert the new API asserts

* Remove not needed file from .NET Core proj

* Remove Program.cs and emitEntryPoint from test app

* Fix test: new line char for unix

* Fix the leftover conditional

* Passes on both Windows and Ubuntu

* Add CI scripts

* Bump the version to beta

* Respond to Castle's NetCore port.
Now we don't need to import anything and have pure netcore project.
Also fixed the issue introduced by nsubstitutegh-238, i.e.
`ExpectedExceptionAttribute` does not exists anymore in
`NUnit.Framework`, so I wrapped it in a `Assert.Throws<Exception>`.

* Fix artifacts path in appveyor script

* FAKE build script for .NET Core

* Add a separate csproj for .NET 4 tests because they don't play well with .NET Core. For more details see:  dotnet/corefx#4544 (comment)

* Update FAKE. Sorry...

* Install FAKE.Dotnet

* Fixes for .NET Core artifacts

* XML docs for .NET Core

* Update NuGet

* Explicit dependencies for .NET Core

* Dependencies appear in nuspec

* Update min versions

* .gitignore VS and FAKE files

* Clean up

* Added netstandard1.5 target to build

- Added netstandard1.5 as valid target
- Skipped NETCORE_TARGETS for tasks that are currently incompatible
  (such as tests/tests against docs)
- Documented build params in "-T" task
- Hacked around with FAKE target dependencies to try to selectively build
  NET/dotnetcore projects based on targets. Had to add "soft dependencies"
  on Clean and Version to make sure that, if they are being run, they do
  so prior to build. See [1].

[1]: http://fsharp.github.io/FAKE/soft-dependencies.html

* Fixing nuspec data

baralong added a commit to baralong/NSubstitute that referenced this pull request Feb 13, 2018

Add CI scripts
(DT: Record of Peter's commits got lost while merging nsubstitute#197.
Cherry-picked one of many commits as a marker for these
contributions.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment