开发者

Question when adding a project to a Visual Studio solution

I created a brand new blank Visual Studio 2010 solu开发者_Go百科tion, and added an existing C# Project to it. I built the solution and it compiled correctly.

But when I go the solution folder, I see that the imported C# project is not physically in that folder. It seems it only references the project to wherever it is.

Is this intended? Should I even worry about this?

How can I create a physical import, meaning the project is copied to the solution folder?

Question when adding a project to a Visual Studio solution


How can I create a physical import, meaning the project is copied to the solution folder?

If you want to do this, copy the project to the solution (outside of VS), then add the local copy directly.

The default behavior allows you to share a project between two solutions. This is occasionally useful (if handled with care).


'How do I create a physical import?'

You don't - you're adding a project to the solution which will always result in referencing it in-place. In order to structure your solution you need to copy or move the existing project to the desired folder, created any desired Solution Folders to match the physical structure and then Add existing project as needs be.

The other alternative is to Add new project and then copy all of your project data over from the existing one but this will be prone to errors at some levels.


Adding an existing project always makes reference to the original. That makes sense in a lot of cases. If you want to use the project in a number of solutions and you want to make sure that they are always using the same version then you have the choice to either just reference the compiled library or have it available in each solution. If you do have it available in each solution then the risk is that you will make some mod of it in one solution that breaks the others. I am pretty good at doing this!

As mentioned already if you want to modify that project and don't mind if it gets out of sync with other versions of it then you need to copy it into your solution folder and then add it from there.

The version control software I use pretty much forces me to do that as it does not like code that is not located inside the solution tree.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜