Hi,

I am creating a Add In for VS 2005 for creating a 3 tier application Using
User Templates.  I have created the templates and also the Add In Project
using Add In wizard. And I also created a windows form in the Add In Project
for getting the new solution Name and Path.  I use the following code for
creating the solution and sub solution

void CreateSolutions()
        {
            try
            {
                if (applicationObject != null)
                {
                    if (!System.IO.Directory.Exists(this.txtPath.Text.Trim()
+ this.txtSolutionName.Text.Trim()))
                    {

System.IO.Directory.CreateDirectory(this.txtPath.Text.Trim() +
this.txtSolutionName.Text.Trim());
                    }

this.applicationObject.Solution.Create(this.txtPath.Text.Trim() +
this.txtSolutionName.Text.Trim(), this.txtSolutionName.Text.Trim());

                        //string DAL =

                    string Common = @"C:\ProjectTemplates\1033\Visual
C#\Common\Common.csproj";
                        // string Common =
((Solution2)this.applicationObject.Solution).GetProjectTemplate("Common.zip",
"CSharp");

((Solution2)this.applicationObject.Solution).AddFromTemplate(Common,
txtPath.Text.Trim() +  this.txtSolutionName.Text.Trim() + @"\" +
this.txtSolutionName.Text.Trim() + @"Common\", txtSolutionName.Text +
"Common", false);

this.applicationObject.Solution.SaveAs(this.txtPath.Text.Trim() +
this.txtSolutionName.Text.Trim() + this.txtSolutionName.Text.Trim() +
".sln");

this.applicationObject.Solution.Open(this.txtPath.Text.Trim() +
this.txtSolutionName.Text.Trim() + this.txtSolutionName.Text.Trim() +
".sln");

                }
            }
            catch
            {
            }
        }


This function CreateSolutions() is called in the Click event of the button
placed in form which is in the Add In Project. When I run the Add In
project, a new development environment gets opened and in the tools menu, i
can find the addin which i created there. On clicking that addin the windows
form gets opened and i give the solution path and solution name.  Now a
solution with the specified name is created with a sub project. In that sub
project the namespace in the classfile should be the solution name. But here
the namespace is *$safeprojectname$.

*Can anyone kindly clarify, what should i do to change the namespace.

And also when i use *GetProjectTemplate("Common.zip", "CSharp")*  method i
get error stating that filename could not be found.  Kindly help me in this
regard.

Thanks in Advance

-- 


Thanks & Regards,
Madhavan L

Reply via email to