Closed sevencat closed 3 years ago
How are you building this project? What version of Visual Studio/MSBuild? Do you have a minimal repro solution?
I've same problem. After upgrading from version 5.2.4 I've noticed build targets for old version were removed from csproj, but no new were added. VS 2019. Target framework 4.8.
I have the same issue. Just happened after updating Refit to version 6.0.15 from 5.2.1 I've attached a Xamarin Workbook file that reproduces the issue and mimics the method that's throwing the method.
Xamarin Workbook Details
Detail | Value |
---|---|
Version | 1.5.0 |
Git Branch | 1.5-release |
Git Hash | 11f83dc |
VSTS Definition | Workbooks & Inspector (Mac) |
Component | Value |
---|---|
macOS | Version 10.15.7 (Build 19H524) (64-bit) |
CPU Cores | 4 / 4 |
Physical Memory | 16 GB |
Component | Version |
---|---|
Mono | 6.12.0.122 |
Xamarin Mac | 7.4.0.4 |
Xamarin iOS | 14.10.0.4 |
Xamarin Android | 11.1.0-26 |
Visual Studio | 8.8.9.10 (808090010) |
It appears that Xamarin Workbooks doesn't support Source Generators yet. That's likely a different issue than the first one.
Oh okay, sorry about that. I had to walk the version back to 5.2.4 to get it to run in my Xamarin project.
=== Visual Studio Community 2019 for Mac ===
Version 8.8.9 (build 10) Installation UUID: 35fb9683-7640-4056-9f83-040b50bd7056 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000122
=== Mono Framework MDK ===
Runtime: Mono 6.12.0.122 (2020-02/c621c35ffa0) (64-bit) Package version: 612000122
=== Roslyn (Language Service) ===
3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa
=== NuGet ===
Version: 5.8.0.6860
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/5.0.103/Sdks SDK Versions: 5.0.103 5.0.102 5.0.101 5.0.100 3.1.406 3.1.405 3.1.404 3.1.403 3.1.402 3.1.401 3.1.302 3.1.301 3.1.300 3.1.202 3.1.200 3.1.102 3.1.101 3.1.100 3.0.100 2.1.701 2.1.503 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 5.0.3 5.0.2 5.0.1 5.0.0 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.0 2.1.23 2.1.22 2.1.21 2.1.20 2.1.19 2.1.18 2.1.17 2.1.16 2.1.15 2.1.14 2.1.13 2.1.12 2.1.7 2.0.9
=== .NET Core 3.1 SDK ===
SDK: 3.1.406
=== Xamarin.Profiler ===
Version: 1.6.12.29 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 11.1.0.26 (Visual Studio Community) Commit: xamarin-android/d16-8/a36ce73 Android SDK: /Users/gaelan/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27)
SDK Tools Version: 26.1.1 SDK Platform Tools Version: 30.0.5 SDK Build Tools Version: 30.0.3
Build Information: Mono: 5e9cb6d Java.Interop: xamarin/java.interop/d16-8@79d9533 ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000 SQLite: xamarin/sqlite/3.32.1@1a3276b Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc
=== Microsoft OpenJDK for Mobile ===
Java SDK: /Users/gaelan/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.8.0.32 Hash: 01a7774 Branch: remotes/origin/d16-8 Build date: 2021-01-14 00:34:58 UTC
=== Android Device Manager ===
Version: 16.8.0.46 Hash: 0a81419 Branch: remotes/origin/d16-8 Build date: 2021-01-14 00:35:22 UTC
=== Xamarin Designer ===
Version: 16.8.0.510 Hash: 44e3f3ce9 Branch: remotes/origin/d16-8 Build date: 2020-12-10 00:06:14 UTC
=== Apple Developer Tools ===
Xcode 12.4 (17801) Build 12D4e
=== Xamarin.Mac ===
Version: 7.4.0.4 (Visual Studio Community) Hash: 5a05865f6 Branch: xcode12.4 Build date: 2021-01-28 02:30:22-0500
=== Xamarin.iOS ===
Version: 14.10.0.4 (Visual Studio Community) Hash: 5a05865f6 Branch: xcode12.4 Build date: 2021-01-28 02:30:23-0500
=== Build Information ===
Release ID: 808090010 Git revision: 0061f975f58a5dba53e339f116371f4853edeb75 Build date: 2021-02-11 11:16:18-05 Build branch: release-8.8 Xamarin extensions: 0061f975f58a5dba53e339f116371f4853edeb75
=== Operating System ===
Mac OS X 10.15.7 Darwin 19.6.0 Darwin Kernel Version 19.6.0 Tue Jan 12 22:13:05 PST 2021 root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
=== Enabled user installed extensions ===
.NET Core support for Mono.Debugging 8.0.5 Android Signature Tool 2.2.0
GitHubContribute to xamarin/AndroidDesigner.EPL development by creating an account on GitHub.
I've same problem.
refit version 6.0.1 and 6.0.15
refit.Newtonsoftjson 6.0.1
VS 2019, Target framework 4.6.1
`
[Headers("Content-Type: application/json")]
public interface ILabTicketAPI
{
[Post("/regist/{parkId}/{ymd}")]
Task<string> Test(string parkId, [AliasAs("ymd")] string today);
}
var clinet = new HttpClient();
clinet.BaseAddress = new Uri(setting.BaseUrl);
var refitSettings = new RefitSettings()
{
ContentSerializer = new NewtonsoftJsonContentSerializer(
new JsonSerializerSettings()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
DefaultValueHandling = DefaultValueHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore,
})
};
labTicketApi = RestService.For<ILabTicketAPI>(clinet, refitSettings); ---> Throw Exception
`
@clairernovotny
I have the same problem i updated to 6.0.15 from 5.2.4 framework : 4.7.2
My Interface
public interface IInvoiceApi
{
[Refit.Post("/{mainalias}")]
Task
Implementation
private async Task
@mekangarayev @namilkimfree As this is related to Source Generators, I need more information about how the project is built, not just the interface itself.
What version of VS are you using and how are you building the project when you see this error? If you're building on the command line, what do you see with msbuild /version
?
@clairernovotny VS version = Version 16.8.4 msbuild / version 15.0 refit version 6.0.1 and 6.0.15 refit.Newtonsoftjson 6.0.1 VS 2019, Target framework 4.6.1
How is msbuild 15.0 is being used? How is that being located? That's the VS 2017 version of MSBuild.
It is Programfiles(x86)₩msbuild₩15.0
Understood, but how are you getting that? Are you calling a "Developer Command Prompt"? What is putting that in the path?
MSBuild shouldn't generally be in the path like that as it's pulling in that older version and will cause you other issues too.
.Net Framework winforms version .Net Framework 4.6.1 "Developer Command Prompt" path is C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools
.csproj value is
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DE3379A5-7641-42B7-89DA-1D285137640D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>RefitNewVersionTest</RootNamespace>
<AssemblyName>RefitNewVersionTest</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>RefitNewVersionTest.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Refit, Version=6.0.0.0, Culture=neutral, PublicKeyToken=2f9b1262776509f5, processorArchitecture=MSIL">
<HintPath>..\packages\Refit.6.0.15\lib\net461\Refit.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.Json.5.0.0\lib\net461\System.Net.Http.Json.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.5.0.0\lib\net461\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.5.0.1\lib\net461\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="IGitHubApi.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="User.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
.NET 5.0 Winforms version .NET(5)
it is success , don't throw exception.
.csproj value is
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Refit" Version="6.0.15" />
</ItemGroup>
</Project>
Thanks. I'll look into the issue with the Roslyn team but my first guess is that there's an issue with Source Generators using older packages.config nuget format. There's no reason to use that anymore -- can you right click the packages.config
file in VS and select the "convert to PackageReference" option and try again? I believe that context menu option should be there.
@clairernovotny thank you
.Net Framework 4.6.1 is migrating to PackageReference, so it does not throw an exception.
it's done!
Yes, perfect, it works!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
version:Refit.6.0.15.nupkg netframework:4.8