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

Use latest version of 'System.Threading.Tasks.Extensions' #690

Closed
godrose opened this issue Sep 7, 2018 · 5 comments
Closed

Use latest version of 'System.Threading.Tasks.Extensions' #690

godrose opened this issue Sep 7, 2018 · 5 comments

Comments

@godrose
Copy link

godrose commented Sep 7, 2018

The version 4.9.0 depends on specific version 4.3.0 of System.Threading.Tasks.Extensions package.
This introduces conflicts with other external packages that use later versions of this package (like System.Reactive)

@stakx
Copy link
Contributor

stakx commented Sep 7, 2018

Hi @godrose. Moq is currently intentionally specifying an older version of the STTE NuGet package because of the awful binding redirect problems the latest version of the day caused; see #566 (comment).

But Moq doesn't pin that exact version. You should still be able to install a later version of STTE in your project. This might take some fiddling with NuGet settings.

While Moq is targeting net45 and netstandard13, I am not going to change that particular dependency. (Later edit: Let's not be irrational about it and see if things have improved by now.) Sorry if this seems irrational, I've been burnt rather badly #566 and don't want to run any risk of putting everyone back in that situation.

That being said, NuGet tooling has likely improved in the meantime. Once we update the targeted platform(s) for Moq (see e.g. #630), I'll reevaluate & update all System package dependencies. That's likely going to happen for Moq 4.11.0.

@godrose
Copy link
Author

godrose commented Sep 11, 2018

@stakx Thanks for the reply.
I was able to install the latest version. That's how I got the conflict. Redirect didn't help.
I guess I'll wait until 4.11.0 then.

@stakx
Copy link
Contributor

stakx commented Sep 11, 2018

@godrose - If you are using a recent version of Visual Studio and MSBuild, there should in theory be no need to manually configure binding redirects, unless perhaps you created your project file with previous tooling versions. Find a few things below that you can try.

Using a recent VS version, things should be as simple as this: Create a new console app project (I've tried with both .NET 4.6.1 and .NET Core 2.0). Then install Moq 4.10.0. Then install STTE 4.5.1. The NuGet package manager will tell you that that it's going to upgrade STTE from version 4.3.0 to 4.5.1. Code & run.

Make sure that the project which references Moq, or the executable project "above" it, references the desires version of the STTE package to enforce that package version.

If you are targeting .NET Core, you shouldn't have to do anything esle since .NET Core isn't as strict when it comes to assembly versioning as the .NET Framework.

If you are targeting the .NET Framework however, and you're using the new SDK-style .csproj format, any required binding redirects should be automatically generated for you in the bin\ output folder's .config file (not in the one in your project root!).

If you are not using the new SDK-style .csproj format, you might want to check that there is a <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> entry in your .csproj. This should enable the automatic redirect generation even for the old project file format.

For Moq 4.10.0 and STTE 4.5.1 (both the most recent versions at this time of writing), the generated binding redirect in bin\$(Configuration)\$(ProjectName).exe.config should probably look as follows:

<configuration>
   ...
  <runtime>
    ...
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>
    ...
  </runtime>
  ...
</configuration>

@stakx
Copy link
Contributor

stakx commented Dec 3, 2018

@godrose - Moq 4.10.1 which now uses System.Threading.Tasks.Extensions 4.5.1 should become available on NuGet.org in a short moment.

@godrose
Copy link
Author

godrose commented Dec 3, 2018 via email

@devlooped devlooped locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants