Saqib
Saqib

Reputation: 7412

C# project (.CSProj), linking to files with flat directory structure

I have a C# class library project, which includes several external files as "links".

In the project file, this comes out as:

<None include="MyFile.txt">
    <link>MyFile.txt</link>
    <CopyToOutputDirectory>CopyIfNewer</CopyToOutputDirectory>
</None>

That works perfectly fine:

But now I want to rearrange my project into directories. In the above, I replaced Myfile.txt with MyDir\MyFile.txt in the link tag.

Now, I end up with a directory called MyDir in the output directory - which I don't want. I would like to have the file in the directory in Solution Explorer, but not in the output folder.

I can't find any way to do this - is it possible?

Upvotes: 5

Views: 2123

Answers (2)

giammin
giammin

Reputation: 18958

this behavior is by design for avoiding duplicate file conflict and other similar problems.

You should arrange your project files with visual studio Solution folder instead of directories

http://msdn.microsoft.com/en-us/library/sx2027y2.aspx

Upvotes: 1

Chris Trombley
Chris Trombley

Reputation: 2322

Solution folders are what you want, I think.

Upvotes: 1

Related Questions