views:

32

answers:

1

I'm trying to build a Visual Studio add-in.

For long-winded reasons (to do with using disassembled assemblies courtesy of .NET Reflector) I removed the reference to the EnvDTE assembly, then re-added it. My project still builds without any problems but when I run my project I get the following exception.

System.IO.PathTooLongException occurred Message=The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. Source=mscorlib StackTrace: at System.IO.PathHelper.GetFullPathName() InnerException:

None of my references have particularly long paths - they're all the GAC and roughly the same length. I'm not trying to do anything different from before I had trouble with the EnvDTE assembly.

Does anyone have any ideas what might be causing this and how it can be resolved?

UPDATE: My csproj file shows the following reference paths:

<ItemGroup>
    <Reference Include="BoneSoft.CSS">
      <HintPath>bin\BoneSoft.CSS.dll</HintPath>
    </Reference>
    <Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <EmbedInteropTypes>True</EmbedInteropTypes>
    </Reference>
    <Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <EmbedInteropTypes>False</EmbedInteropTypes>
    </Reference>
    <Reference Include="HtmlAgilityPack">
      <HintPath>bin\HtmlAgilityPack.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
    <Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="microsoft.visualstudio.shell.interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>
A: 

Try opening up your .csproj in notepad and look at the Reference entries for all of your assemblies. What's almost certainly happened is they got added with a weird relative path that caused it to extend past the 260 character limit in the HintPath node.

To fix just delete the HintPath element, reload your project and the issue should go away. It isn't necessary for EnvDTE.

JaredPar
Thanks for your help JaredPar, but as you can see in my edited posting above, none of the reference paths appear to be unusually long.
awj