2015-09-15 34 views
4

每一個項目,我在Visual Studio 2013中打開現在突然給我下面的錯誤:所有Visual Studio 2013版本是現在沒有

EverySingleProject.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets

這是文件中:

Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"

這是爲什麼會失敗?

回答

3

我有這樣的2天前。

This救了我。

希望這會有所幫助。

編輯:

Fortunately the solution is simple:

  1. In Windows Explorer navigate to the project
  2. Right Click on the .cproj file, select Properties, and un-check the "Read Only" checkbox
  3. Open up the .cproj file in Notepad
  4. On line 2 change xmlns="http://schemas.microsoft.com/developer/msbuild/2008" to xmlns="http://schemas.microsoft.com/developer/msbuild/2003" (notice this only difference is we changed 2008 to 2003)
  5. Save your changes
  6. In Visual Studio right click on the (currently unavailable) project and select "Reload Project"
  7. The project will now load normally and you can get on with your life
+0

雖然此鏈接可以回答這個問題,最好是在這裏有答案的主要部件,並提供鏈接以供參考。如果鏈接頁面更改,則僅鏈接答案可能會失效。 –

+0

啊好吧,我以前不想一想(: – Alex

+1

這應該是一個有點明顯,「改變2008年至2003年」不能對這一問題的妥善解決 –

0

原來的我在的MSBuild文件夾一個文件被損壞了。 此文件:Microsoft.Common.CurrentVersion.targets

而另一個需要的文件已經消失在以太網。 此文件:Microsoft.CSharp.CurrentVersion.targets

均未被替換,或固定,修復過程中,然後Visual Studio中的一個完整的重新安裝。

我最終從另一個安裝中複製文件,現在一切恢復正常。

19

如果您嘗試在早期版本的Visual Studio中打開VS 2017 RC'簡化'.NET Core csproj文件,也會出現此錯誤。

這些新的項目文件看起來是這樣的:

<Project Sdk="Microsoft.NET.Sdk"> 
    <PropertyGroup> 
    <OutputType>Exe</OutputType> 
    <TargetFramework>netcoreapp1.0</TargetFramework> 
    </PropertyGroup> 
    <ItemGroup> 
    <PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" /> 
    </ItemGroup> 
</Project> 

(來源:https://blogs.msdn.microsoft.com/dotnet/2016/12/12/updating-visual-studio-2017-rc-net-core-tooling-improvements/

你需要使用最新VS 2017年的版本中打開它們。

+2

是否有可能降級/ convert'.csproj'文件,以便我可以在Visual Studio 2015中使用代碼庫的其餘部分?我下載了一個開源項目,其中維護人員已將項目升級到VS2017,所以現在我無法再在VS 2015中打開它。 – Shiva

0

通過增加固定它:

<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
在.csproj的文件

0

我也是這樣。該項目可能是(無證!)一個VS 2017年的項目,我用VS 2013

我所做的是:

  1. 創建一個新的VS 2013 Web應用程序項目,
  2. 複製並粘貼所有原項目的其他文件到新的項目文件夾,
  3. 打開新項目,幷包括所有必要的原始項目文件,
  4. 做手腳引用,等一段時間,直到所有的編譯錯誤消失,
  5. 運行,測試,調整。

真的不理想,但它是一個小型演示項目的最快解決方案。不知道你會怎麼做一個大的解決方案。也許有人會在某個時候構建一個轉換器。也許微軟可以做到這一點。 [笑自我。]

0

刪除相應的* .csproj.user文件有助於爲相同的症狀。

相關問題