创建项目模板时,在Visual Studio 2012中更新IIS Express端口 [英] Update IIS Express port in Visual Studio 2012 when creating project template

查看:108
本文介绍了创建项目模板时,在Visual Studio 2012中更新IIS Express端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道标题似乎有点误导,但问题相当简单.

I know the title seems a bit misleading but the problem is fairly simple.

我刚刚在Visual Studio 2012 Express for Web中创建了一个新的WebApplication项目,添加了几个额外的文件,并将该项目导出为新模板.直到我开始从此模板调试新的项目实例之前,一切似乎都工作正常.当我打开项目实例的属性窗口时,我注意到"Web"下的"Project URL"设置指向http://localhost:50637,其中端口号与我用来创建模板的项目相同.显然,我希望新的项目实例具有其自己的端口,并且我可以轻松地分配一个新的端口.但是我的问题是,在创建新的项目实例时,Visual Studio是否可以自动执行操作?我想我将不得不为模板项目配置项目属性,例如...

I just created a new WebApplication project in Visual Studio 2012 Express for Web, added a couple of extra files and exported the project as a new template. Everything seemed to be working fine until I started debugging a new project instance from this template. When I opened the properties window for the project instance I noticed that the "Project URL" setting under "Web" pointed to http://localhost:50637 where the port number is the same as the project I used to create the template from. Obviously I want the new project instance to have its own port and I can easily just assign a new one. But my question is whether it is possible for Visual Studio to do automatically when creating new project instances? I imagine I would have to configure the project properties for the template project some how...

推荐答案

将项目导出为新模板后,解压缩导出的zip文件. 这样,您就可以编辑该网站的.csproj文件. 在记事本中打开.csproj文件,然后编辑以下部分:

After you export the project as a new template, unzip the exported zip file. This is so that you can edit the .csproj file for the website. Open up the .csproj file in notepad and edit the following section:

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>True</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>0</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          ***<IISUrl></IISUrl>***
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>

<IISUrl>http://localhost:59344/</IISUrl>所在的位置,只需删除http://localhost:59344/网址即可. 然后重新压缩文件夹并安装扩展程序.

Where the <IISUrl>http://localhost:59344/</IISUrl> is, just remove the http://localhost:59344/ url so that it is blank. Then rezip up the folder and install the extension.

创建项目后,将自动创建一个新的端口号.

A new port number will then be created automatically when the project is created.

这篇关于创建项目模板时,在Visual Studio 2012中更新IIS Express端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆