【问题标题】:csproj is Missing Root Elementcsproj 缺少根元素
【发布时间】:2016-05-10 10:09:20
【问题描述】:

我正在尝试打开从 Github 下载的项目,但我被告知缺少 csproj 的根元素。我尝试按照此链接中的说明进行操作

http://www.howtosolutions.net/2013/02/solving-project-file-error-could-not-find-part-of-the-path-with-visual-studio/

但无法更改文件路径。我还被告知,当您删除 suo 和用户文件时项目应该打开,但删除 suo 文件时它不起作用,我无法找到用户文件。也尝试在我的 vm 上打开同一个项目,并且它在那里正确打开,所以问题必须与我的 Visual Studio 2015 相关。有人对解决我的问题有什么建议吗?

也应要求,这里是一些 csproj 文件

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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)' == '' ">x86</Platform>
        <ProjectGuid>{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}</ProjectGuid>
        <OutputType>AppContainerExe</OutputType>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>SDKTemplate</RootNamespace>
        <AssemblyName>BarcodeScanner</AssemblyName>
        <DefaultLanguage>en-US</DefaultLanguage>
        <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
        <TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
        <TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
        <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
        <EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
        <FileAlignment>512</FileAlignment>
        <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
  </PropertyGroup>

【问题讨论】:

  • 能否包含 csproj 文件的顶部?这将帮助我们查看它是否格式错误。它可以用任何文本编辑器打开。
  • 我没有看到任何异常。您是否尝试过通过 xml 验证器运行它?
  • 没有。不知道是什么
  • 您认为问题可能出在 Visual Studio 上吗?

标签: c# visual-studio csproj


【解决方案1】:

如果您没有忘记最后一行,解决方案实际上非常简单:您缺少Project 元素的 XML 结束标记。

在文件末尾,检查是否有&lt;/Project&gt;,如果没有,请添加它(&lt;/ProjectGroup&gt; 行之后),保存文件并尝试使用 Visual Studio 再次打开。

【讨论】:

    猜你喜欢
    • 2012-04-24
    • 2012-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多