OpenAPITools / OpenAPITools/openapi-generator
[BUG] [csharp-netcore] <TargetFrameworkIdentifier> Must Be '.NETPortable'
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
I keep encountering an issue when creating a csharp-netcore client API for ShipEngine. I have been unable to find a fix.
It seems the ProjectTypeGuids is making the project be noticed as a .NETPortable project rather than a .NETStandard project even though the TargetFrameworkIdentifier is .NETStandard.
I have tried removing the ProjectTypeGuids which breaks the project further. Changing the TargetFrameworkIdentifier to .NETStandard does not resolve the issue either.
Edit: I am using Visual Studio 2017 on Windows 10.
Edit 2: The exact error message is
The project file 'Org.OpenApiTools' cannot be opened.
The
<TargetFrameworkIdentifier>for a portable project must be '.NETPortable'.
Complete .csproj:
<?xml version="1.0" encoding="utf-8"?>
<!--
ShipEngine API
ShipEngine is the world's best multi-carrier shipping API, with more than 20 supported shipping carriers. You can easily get and compare shipping rates, print labels, track your shipments, and validate addresses anywhere in the world. ### Worldwide Major Carrier Support Access the top global carriers in minutes—instead of weeks. Simply [connect your existing carrier accounts](https://docs.shipengine.com/docs/setup-a-carrier) in the API dashboard, and then [begin creating labels](https://docs.shipengine.com/docs/use-a-specific-service). ### Real-Time Tracking [Track packages](https://docs.shipengine.com/docs/track-a-package) across any of our 20+ supported carrier accounts and create tracking events to keep your customers up-to-date. Easily integrate real-time tracking information for shipments into your app, email, or SMS. ### Get Rates Across Carriers Make sure you ship as cost-effectively as possible by [quickly comparing rates](https://docs.shipengine.com/docs/get-shipping-rates) using the ShipEngine Rates API. As long as you have the carrier connected to your account, you'll be able to see and compare different rates and services. ### Global Address Validation No matter your shipping volume, failed deliveries and address change surcharges cut into your bottom line and damage perception with customers. Our address validation services ensure your packages make it to the right place the first time. [Learn how to leverage our address validation services here.](https://docs.shipengine.com/docs/address-validation) ShipEngine supports address validation for over 180 countries, including the United States, Canada, Great Britain, Australia, Germany, France, Norway, Spain, Sweden, Israel, Italy, and more.
The version of the OpenAPI document: 1.0.0
Contact: sales@shipengine.com
-->
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{321F1932-4D03-4337-9132-7D0DA8AD230B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Org.OpenAPITools</RootNamespace>
<AssemblyName>Org.OpenAPITools</AssemblyName>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>15.0</OldToolsVersion>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.57.0" />
<PackageReference Include="JsonSubTypes" Version="1.5.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="RestSharp" Version="106.6.7" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
<Import Project="..\..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
</Project>
Any ideas?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the error with the complete generated .csproj in Visual Studio 2017 on Windows 10, then compare its ProjectTypeGuids and target framework metadata with the referenced project.json and NETStandard.Library targets import. Done means the generated C# client project opens successfully without the portable-project TargetFrameworkIdentifier error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100