views:

42

answers:

1

In my company, we've been converting .net "Web Sites" to "Web Applications". I have become the go-to person for this task.

In order to accomplish this, I create a new project, copy all the files from the "Web Site" and include them in the project, and run the "Convert To Web Application" tool to create the "design" files. This is totally awesome, however, I still need to manually add library and service references to my new project to match the references in the "Web Site".

Can I automate this process as well?

CLARIFICATION: I think that this question could be generalized as: Can I copy references from one VS project to another?

CORRECTION to the above: Actually, it does not generalize this way because "Web Site" references are kept in the web.config file while "Web Application" references are kept in the project file.

+1  A: 

Yes you can. The project file (.csproj, etc) is an xml file. If you open the project file in a text editor you will see a section named ItemGroup. There you will find your references.

37Stars
This is a good start. However, it looks like with the "Web Site", the references are stored in web.config in a different format than they are stored in the project file XML.It looks like this could be automated, but I wonder if a tool already exists...
Rice Flour Cookies
I'm not aware of one that exists. You could write a quick app that would load the web.config and extract the information you want using Linq. I'll dig up a previous project and see if I can post some code.
37Stars
Actually the code I was thinking of won't help. It loaded data from a comma separated file into an XMLDocument. Then I was able to use LINQ to query the DOM. Let me know if you want to see it.
37Stars