-1

I have a project in Visual Studio 2010 that I want to publish to a server running IIS. I know how to publish a web site from Visual Studio, but the problem is when I publish my project to the server then I have to manually create the Virtual Directory to publish to.

Can we automatically create a Virtual Directory when publishing a website?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Mou
  • 15,673
  • 43
  • 156
  • 275

1 Answers1

2

Given you know how to publish, I assume you already have a publish profile. You can edit this profile (or edit a copy of your existing profile).

Then according to various resources all you have to edit is:

<DeployAsIisApp>False</DeployAsIisApp> <!--False for Directory, True for Application-->
<DeployIisAppPath>Default Web Site/DirectoryOrApplication</DeployIisAppPath>

Now when you publish the site, a directory named DirectoryOrApplication will be created when it doesn't exist.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • 1
    i asked how to create virtual directory in another pc from VS 2010 IDE when i would publish my site in another pc. is it possible? – Mou Dec 19 '14 at 15:25
  • 1
    Yes it is possible, I explained how in my answer. Which part is not clear? – CodeCaster Dec 19 '14 at 15:26
  • i know how to publish a web site to remote pc in lan but i saw virtual directory is not creating...so i am interested to how to create virtual directory in remote pc IIS along with publish. it would be great help if discuss in detail like all the steps. thanks – Mou Dec 22 '14 at 08:06
  • @Mou no I won't "discuss all steps in detail", I'm not writing a publishing tutorial here. The basics of publishing to IIS are all on the web, you just need this specific part in your publish profile in order for the virtual directory to be created. What parts of my answer did you apply and which parts don't you understand? – CodeCaster Dec 22 '14 at 08:08
  • @CodeCaster usually a virtual directory should be mapped to a physical path. how is that done? its not clear in your answer, im looking to do the same as Mou. Thanks – meda Feb 19 '15 at 21:19