[英]The element <#text> beneath element <Target> is unrecognized in Azure
Have a big problem here.这里有一个大问题。 I can't open any type of project in Visual Studio.
我无法在 Visual Studio 中打开任何类型的项目。 Even when I creating a new one I get the error:
即使我创建一个新的,我也会收到错误:
the element <#text> beneath element is unrecognized.
元素下面的元素 <#text> 无法识别。 C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.6\Microsoft.WindowsAzure.targets.
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.6\Microsoft.WindowsAzure.targets。
If any one know please help me.如果有人知道请帮助我。
This also happens with generic XML errors.一般的 XML 错误也会发生这种情况。 In my case it was
>>
somewhere in the project file.在我的例子中,它是
>>
项目文件中的某个地方。 Was a copy-paste error during conflict resolution that introduced it.是在引入它的冲突解决期间的复制粘贴错误。 Sadly, the output does not include the line that has the error, so try searching for
<<
and >>
in the file, to see if that is an issue somewhere.遗憾的是,output 不包含有错误的行,因此请尝试在文件中搜索
<<
和>>
,看看这是否是某处的问题。
I faced this problem too. 我也遇到了这个问题。 The error text was:
错误文本是:
The element <#text> beneath element <Target> is unrecognized.
c:\Program Files (x86)\MSBuild\12.0\Bin\Microsoft.CSharp.CurrentVersion.targets
The solution for me was to check the indicated file against a working one from one of my coleagues. 对我来说,解决方案是检查指示文件与我的一个同事的工作。 Even an XML parser or even a browser would pop-up an error when faced to this sort of error.
即使是XML解析器甚至是浏览器也会在遇到这种错误时弹出错误。 A element under
<Target>
was corrupt. <Target>
下的元素已损坏。 Instead of <Csc ... />
I had exactly 07sc ... />
. 而不是
<Csc ... />
我完全没有07sc ... />
。 I fixed formatting and It worked. 我修复了格式化并且工作正常。 Mind you that the file indicated in the error text (
Microsoft.CSharp.CurrentVersion.targets
) was the guilty one. 请注意,错误文本(
Microsoft.CSharp.CurrentVersion.targets
)中指示的文件是有罪的。 Hope this helps. 希望这可以帮助。
This sure is a installation error and i would suggest don't try to fix because there may be more such errors. 这肯定是一个安装错误,我建议不要尝试修复,因为可能会有更多这样的错误。 I have seen a few of such errors during my work with partners and mostly these errors are caused by botched installation due to real-time, virus scanner or some unknown issues in the machine.
我在与合作伙伴合作期间看到了一些这样的错误,这些错误主要是由于实时,病毒扫描程序或机器中的一些未知问题导致的安装错误造成的。
Here is what I could suggest: 这是我可以建议的:
It worked in past so I hope it will work with you as well. 它过去有效,所以我希望它也能与你合作。
This also happens if a Property, that should be under a <PropertyGroup>
node is a child of a <Target>
node 如果应该位于
<PropertyGroup>
节点下的<PropertyGroup>
是<Target>
节点的子节点,也会发生这种情况
wrong (produces the error): 错(产生错误):
<Project ToolsVersion="15.0" DefaultTargets="CalculateVariables" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CalculateVariables">
<IsWrong>true</IsWrong>
</Target>
</Project>
right (works): 对(工程):
<Project ToolsVersion="15.0" DefaultTargets="CalculateVariables" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CalculateVariables">
<PropertyGroup>
<IsWrong>true</IsWrong>
<PropertyGroup>
</Target>
</Project>
There will be a Typo in the .csProject. .csProject中会有一个错字。 You can copy and paste the csProj XML into https://freeformatter.com/xml-formatter.html and it will show what line is causing the problem!
您可以将csProj XML复制并粘贴到https://freeformatter.com/xml-formatter.html ,它将显示导致问题的行!
I had this problem due to git merge conflicts inserting invisible characters into the xml file. 我有这个问题是由于git合并冲突将不可见的字符插入xml文件。 To fix this:
解决这个问题:
open sln file in a text editor and copy the contents into an online xml validator ( https://www.xmlvalidation.com/ ) 在文本编辑器中打开sln文件并将内容复制到在线xml验证器( https://www.xmlvalidation.com/ )
find location of invisible characters and either delete them or retype the line 找到不可见字符的位置,然后删除它们或重新键入该行
I had a similar problem and it was caused by an automatic git merge that went wrong;我有一个类似的问题,它是由错误的自动 git 合并引起的; there were a number of
有很多
<<<<<<<
<<<<<<<
and和
'>>>>>>>
'>>>>>>>>
on some lines in the project (.csproj) file.在项目 (.csproj) 文件的某些行上。 And that was making the build fail.
这使构建失败。
Solution: remove the lines that contain those characters and reload the project.解决方案:删除包含这些字符的行并重新加载项目。
I had the same issue and as there are over a 100 elements in the file I couldn't find the issue.我有同样的问题,因为文件中有超过 100 个元素,所以我找不到问题。 I did a VS repair with the installer which took about an hour and all is working.
我用安装程序进行了 VS 修复,花了大约一个小时,一切正常。 Afterwards I did make a backup of the file.
之后我确实备份了文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.