Pergunta

I included some files in my .csproj file using a wildcard (editing the .csproj file manually), like this:

<ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="..\..\**\Foo???Class.cs" />
</ItemGroup>

It worked flawlessly. But when I created a copy of my whole code tree in another directory, suddently it stopped working. When I open my original directory, it works, but when I open the copy in another directory, VS says:

The file '....**\Foo???Class.cs' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory.

Why it happens? How can I solve this problem?

Foi útil?

Solução

Looks like Visual Studio has a limitation regarding the length of folder names.

The new directory (in which I placed the copied code) name was 42 characters long. The moment I reduced its name to 20 chars the wildcard magically worked, as in the original code tree.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top