C# assembly - shortcuts
I have a C# project that has multiple folders: Folder1, Folder2.
I ad开发者_如何学运维ded a shortcut in 'Folder1' to an xml file that is already in 'Folder2'. In this case when I compile the project the xml file will I have two copies in the assembly?
You were not clear with your description - did you reference the file with a shortcut, or did you add it to Folder1 by using the VS Solution Explorer and adding an existing item as a link?
The two methods are quite different. If you simply went into the filesystem and added a shortcut, then that is not automatically part of the project unless you specifically add it. And if you did add it, then it obviously can't be compiled, the best you could do is just have it set to No Compile and copy to the output directory.
If you added the file to folder one via the VS solution explorer and added it as a link, then it will be part of the project, and will be included twice, but it will be placed in Folder1 under the bin/debug or bin/release folder upon building. There will be no clash because they are in different folders, and they are not compiled, simply copied to the folder structure under the output directory.
Edit: and it won't be part of the assembly unless you set it to be a Resource or Embedded Resource. If you do that then yes, it will be in the assembly, but under two different resource paths.
In the Properties(context menu) of the selected file in the Solution Explorer change Build Action property to No Compile.
精彩评论