Skip to content

Commit

Permalink
Merge pull request #1086 from reactiveui/packages-config-error
Browse files Browse the repository at this point in the history
Add error case for packages.config to prevent runtime issues
  • Loading branch information
clairernovotny authored Feb 23, 2021
2 parents ecb6ef2 + af5a13d commit 19a4c66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ Refit currently supports the following platforms and any .NET Standard 2.0 targe

Refit 6 requires at Visual Studio 16.8 or higher, or the .NET SDK 5.0.100 or higher. It can target any .NET Standard 2.0 platform.

Refit 6 does not support the old `packages.config` format for NuGet references (as they do not support analyzers/source generators). You must
[migrate to PackageReference](https://devblogs.microsoft.com/nuget/migrate-packages-config-to-package-reference/) to use Refit v6 and later.

#### Breaking changes in 6.x

Refit 6 makes [System.Text.Json](https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-overview) the default JSON serializer. If you'd like to continue to use `Newtonsoft.Json`, add the `Refit.Newtonsoft.Json` NuGet package and set your `ContentSerializer` to `NewtonsoftJsonContentSerializer` on your `RefitSettings` instance. `System.Text.Json` is faster and uses less memory, though not all features are supported. The [migration guide](https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0) contains more details.
Expand Down
7 changes: 6 additions & 1 deletion Refit/targets/refit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@

<Target Name="_RefitMSBuildVersionCheck"
Condition=" '$([System.Version]::Parse($(_RefitMSBuildMinVersion)).CompareTo($([System.Version]::Parse($(MSBuildVersion)))))' &gt; '0' "
BeforeTargets="ResolveAssemblyReferences;Build;Rebuild">
BeforeTargets="ResolveAssemblyReferences;Build;Rebuild" >
<Error
Text = "Projects using Refit cannot build using MSBuild '$(MSBuildVersion)'. MSBuild '$(_RefitMSBuildMinVersion)' or later is required." />
</Target>

<Target Name="_RefitProjectRestoreTypeCheck" BeforeTargets="ResolveAssemblyReferences;Build;Rebuild" DependsOnTargets="_GetRestoreProjectStyle">
<Error Condition="'$(RestoreProjectStyle)' == 'PackagesConfig'"
Text="Packages.config does not support Analyzers, including Source Generators. Migrate to PackageReference: 'https://devblogs.microsoft.com/nuget/migrate-packages-config-to-package-reference/'" />
</Target>
</Project>

0 comments on commit 19a4c66

Please sign in to comment.