You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio 2017创建Xamarin.Forms项目未生成.csproj文件求助

Hey there, let's work through this .csproj generation issue you're hitting with Xamarin.Forms in Visual Studio 2017 15.5.7. As someone new to Xamarin on VS, it makes total sense to feel confused about PCL vs .NET Standard—those transitions were a bit messy back then, and your older VS version might be amplifying the problem. Let's break this down step by step:

Troubleshooting Missing .csproj in Xamarin.Forms Projects

1. First, Update Your Visual Studio 2017 Installation

VS 2017 15.5.7 is quite dated (released in late 2018), and there were known bugs with Xamarin project template generation in earlier 15.x builds. Here's how to fix that:

  • Open the Visual Studio Installer, head to the Updates tab, and install the latest available update for VS 2017 (aim for 15.9.x, the final release for this version). This patches a ton of tooling and template issues that could be preventing your .csproj from being created.
  • Double-check that the Mobile development with .NET workload is fully updated—partial updates often break template functionality.

2. Clear Up the PCL vs .NET Standard Confusion

Since you're new to this, let's simplify:

  • PCL (Portable Class Library): The old way to share code across .NET platforms. Microsoft deprecated PCL in favor of .NET Standard, so avoid these templates if you can.
  • .NET Standard Class Library: The modern, recommended approach. It has clear platform support mappings, and Xamarin.Forms works seamlessly with it in VS 2017 15.5+.

When creating your rga_inventory_app, pick the .NET Standard code sharing option first (skip Shared Projects for now—they have a different structure that can cause unexpected issues if you're expecting a traditional .csproj setup).

3. Manually Create a .csproj If Updates Don't Help

If updating VS doesn't resolve the missing .csproj issue, you can build one manually for your shared code:

  1. Create a new Class Library (.NET Standard) project in VS 2017, name it something like rga_inventory_app.Core.
  2. Right-click the project > Edit .csproj, then replace the default content with this Xamarin.Forms-compatible template:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="3.1.0.697729" /> <!-- Use a version compatible with VS 2017 15.5; 3.1 is a safe bet -->
  </ItemGroup>
</Project>
  1. Add your Xamarin.Forms pages, viewmodels, and other shared code to this project.
  2. Create the platform-specific projects (Android, iOS, UWP) and reference this .NET Standard project in each of them.

4. Fix Corrupted Template Caches

Sometimes VS's template cache gets messed up, causing projects to fail generating. Here's how to reset it:

  • Close Visual Studio entirely.
  • Delete these cache folders (replace <YourUsername> with your actual Windows username, and <InstanceID> with the unique ID for your VS 2017 install):
    • C:\Users\<YourUsername>\AppData\Roaming\Microsoft\VisualStudio\15.0_<InstanceID>\TemplateCache
    • C:\Program Files (x86)\Microsoft Visual Studio\2017\<Edition>\Common7\IDE\ItemTemplatesCache
    • C:\Program Files (x86)\Microsoft Visual Studio\2017\<Edition>\Common7\IDE\ProjectTemplatesCache
  • Reopen Visual Studio—it will rebuild the template cache, which might fix the generation issue.

内容的提问来源于stack exchange,提问作者Peter Kay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 06:55:26