Skip to content
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

Update Moq to version 4.2 #15

Closed
wants to merge 11 commits into from
Closed

Conversation

kevinkuszyk
Copy link

Hi Remo,

I've updated the Moq package to the latest 4.1 today. I also updated the FluentAssertions dependency to use the NuGet package.

Can you push this update to NuGet as we want to update our solution to to the latest Moq, but we are blocked at the moment by Ninject.MockingKernel.Moq.

Thanks,
Kevin

@philippdolder
Copy link

@kevinkuszyk the build fails (https://teamcity.bbv.ch/viewLog.html?buildId=3580&buildTypeId=bt34&tab=buildLog) you can login as guest.

Can you please have a look into it? We had some troubles with the builds lately. Come back to me if you think it is a build server related issue.

@kevinkuszyk
Copy link
Author

I've fixed the initial build errors, but now the silverlight-5.0 version is not building. I'm not sure why - can you take a look let me know what's wrong?

@philippdolder
Copy link

Will have a look into it tomorrow

@kevinkuszyk
Copy link
Author

@philippdolder did you ever get a chance to look at this?

How close to having a stable release from master are you? It looks like Moq 4.1 restriction has already been lifted there and that would enable us to upgrade.

@jarl-dk
Copy link

jarl-dk commented Feb 24, 2014

Please consider upgrading to Moq 4.2

@philippdolder
Copy link

@kevinkuszyk I'm sorry. couldn't look into it :-(
could you update to Moq 4.2 then I will merge and create a new NuGet package, if necessary, I'll do and verify it manually. Promised

@kevinkuszyk
Copy link
Author

@philippdolder I'll try to find some time next week to update it.

@kevinkuszyk
Copy link
Author

@philippdolder I've updated Moq to the latest. It builds fine in VS, but not with the build-release.cmd batch file. I'm afraid I don't know much NAnt, so can you take a look?

I also updated NSubstitute while I was there.

@philippdolder
Copy link

@kevinkuszyk Sorry, I was sick the last couple of days.
Did you follow the instructions in HowToBuild.txt before running build-release.cmd?

@philippdolder
Copy link

Initially I get the following error when running the script

     [copy] Copying 8 files to 'C:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests'.
      [csc] Compiling 7 files to 'C:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests\Ninject.MockingKernel.Test.dll'.
      [csc] c:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests\Ninject.MockingKernel.Moq.dll: error CS1705: Assembly 'Ninject.MockingKernel
.Moq, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' uses 'Moq, Version=4.2.1402.2112, Culture=neutral, PublicKeyToken=69f491c3944
5e920' which has a higher version than referenced assembly 'Moq, Version=4.1.1309.1617, Culture=neutral, PublicKeyToken=69f491c39445e920'
      [csc] c:\Projects\ninject\ninject.mockingkernel\build\net-3.5\tests\Moq.dll: (Location of symbol related to previous error)

Is that the same error that you get?

The problem is the following:

  • We use Moq to test this extension. And take the dependencies from tools\Moq. Which still are 4.1 But we already reference Moq 4.2 in the production assembly. So the compiler has a version conflict. We need to at least update Moq in the tools\Moq as well.

Then I can build, except for SL-5.0, which I don't know how to solve yet. I need to talk to @remogloor regarding this, as I didn't have a deep look inside, yet.

Cheers,
Phil

@kevinkuszyk
Copy link
Author

Hi Phil,

Yes, I followed the instructions in HowToBuild.txt, but I'd forgotten about the tools folder (it's been a while since I looked at this!)

I just pushed an update, and all is building locally again except for the Silverlight version.

Kevin.

@philippdolder
Copy link

Hi Kevin,

ok, thanks. I try to talk to @remogloor asap on what we are still missing to make it work with SL 5 as well.

Phil

@philippdolder
Copy link

Hi Kevin,

I was finally able to talk to @remogloor about this issue.
He reminded me of what I didn't recognize before. There is no need to update Moq or NSubstitute in the Ninject.MockingKernel.* packages.

The current prerelease of Ninject.MockingKernel.Moq already supports Moq 4.2 ([4.0, 5.0) to be precise). Unfortunately, IMO there is a flaw in Nuget which uses the smallest possible version of a dependency, instead of the newest possible version.

There is only a need to update the Moq, NSubstitute etc. dependencies when they change their interface.

To use Ninject.MockingKernel.Moq with the latest version of Moq perform the following steps in the Nuget Package Manager Console

install-package ninject.mockingkernel.moq -pre
update-package ninject.mockingkernel -pre
update-package ninject -pre
update-package moq

This will install and update to the latest prerelease versions of Ninject.MockingKernel.Moq and it's ninject dependencies as well as to the latest stable Moq version.

This should resolve your issue without the need to update Ninject.MockingKernel.
If we would update the dependencies in the package, we would restrict the use to Moq version 4.2 or greater and therefore force all users of previous 4.* version to upgrade.

@kevinkuszyk
Copy link
Author

Thanks Phil. I'd noticed the the pre-release packages had their dependency requirements relaxed. Can we get stable build released to nuget? Whilst I'm ok using pre-release packages in test projects, not everyone can / will.

I'll close this PR, and open a new issue for publishing a new stable version to Nuget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants