The value “” of the “Project” attribute in element

2020-06-03 01:58发布

问题:

I'm getting the following error while trying to load some projects in visual studio 2012:

G:\path\project.csproj : error  : The value "" of the "Project" attribute in element <Import> is invalid. Parameter "path" cannot have zero length.

I'm trying this with a fresh start on the machine after a svn checkout. These projects can be loaded on other machines correctly.

Can some one help me out with this one? Google didn't give me the answer, I hope SO will.

EDIT

This is the relevant part of the csproj file.

<Project ToolsVersion="4.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')" />

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(StyleCopTargets)" />

</Project>

回答1:

You write you start from fresh. I suspect StyleCop isn't installed so the alias value is replaced with a blank leaving the field also blank.

Either remove the reference or install StyleCop. I think that should do the trick.

edit: just for convenience: http://stylecop.codeplex.com/