tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

tiny-cnn vs应用

(UPDATE: See other Tiny Happy Features)

(更新:请参见其他Tiny Happy功能)

tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

At some point soon lots of people are going to start writing these epic blog posts about Visual Studio 2012. They will include LOTS of screenshots (some good and some bad), some small code samples and minimal context. I can't speak for other teams; I can only talk about what we worked on. The <AngleBrackets/> folks in Azure Platform and Tools (ASP.NET, IIS, WCF, EF, Azure much and more) have been putting a lot of work into what I sometimes call "Death by a Thousand Tiny Cuts." It's the little irritants that are as frustrating (or more so) as the big missing features.

在不久的某个时刻,许多人将开始写有关Visual Studio 2012的史诗般的博客文章。它们将包括很多屏幕截图(有些好坏),一些小代码示例和最少的上下文。 我不能代表其他球队; 我只能谈论我们的工作。 Azure平台和工具(ASP.NET,IIS,WCF,EF,Azure等等)中的<AngleBrackets />成员已经在我有时称为“千刀斩死”中进行了大量工作。 小刺激物与大缺失功能一样令人沮丧(或更多)。

Rather than a giant super post (although I'll do that at some point) I thought I'd showcase some Tiny Happy Features that the team worked on just because it made life better. Some are large some are small, but all are tiny happy features.

我认为我会展示一些团队致力于的Tiny Happy Feature ,因为它可以使生活变得更好,而不是一个巨大的超级职位(尽管我会在某个时候这样做)。 有些很大,有些很小,但都是微不足道的快乐功能。

发布和部署方面的改进 (Publishing and Deployment Improvements)

Visual Studio 2012 has a number of subtle but significant improvements to publishing. Of course you likely know you can push code to Azure or AppHarbor using Git. You can publish your web app with Web Deploy which I demonstrated at Mix in my talk Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong. You can see a quick closed-captioned video I did of Web Deployment to Azure in just 4 minutes over here.

Visual Studio 2012对发布具有许多微妙但重要的改进。 当然,您可能知道可以使用Git将代码推送到AzureAppHarbor 。 您可以使用Web Deploy发布您的Web应用程序,这在我在Mix中的演讲 Mix Web Deployment Made Awesome:如果您使用XCopy,您做错了》中进行了演示。 您可以在此处仅4分钟内观看我为Web部署到Azure而制作快速隐藏字幕视频

Visual Studio added web.config transforms a while back so you can have a Web.config along with a Web.debug.config with the changes you want for debug time, and web.release.config for release time. You can add the free SlowCheetah add-on and get transform support for all your config files, not just web.config.

Visual Studio添加了web.config进行了一段时间的转换,因此您可以拥有一个Web.config以及一个Web.debug.config,其中包含您想要的调试时间更改,以及一个web.release.config用于发布时间。 您可以添加免费的SlowCheetah附加组件,并获得对所有配置文件的转换支持,而不仅仅是web.config

However, things fell down because Web Deploy and Visual Studio didn't have a way to easily represent Dev, Testing, Staging, Production, Whatever. You could have build configurations but they didn't relate to deployments, which doesn't reflect a developer's reality.

但是,事情没有了,因为Web Deploy和Visual Studio无法轻松表示开发,测试,登台,生产等等。 您可能具有构建配置,但它们与部署无关,这并不反映开发人员的实际情况。

使用特定于环境的配置发布 (Publishing with Environment-specific Configurations)

Publish Profiles are either created manually, or now in VS2012 downloaded as .publishsettings from your host and imported into Visual Studio. In Visual Studio 2012 publish profiles are stored along with your code in the Properties folder so they can be checked in and used by others.

发布配置文件可以手动创建,也可以现在在VS2012中从主机以.publishsettings下载并导入到Visual Studio中。 在Visual Studio 2012中,发布配置文件与您的代码一起存储在“属性”文件夹中,以便其他人可以检入和使用它们。

tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

You can rename a profile whatever you like by changing the name. Here I've named my publish profile "Production."  There's the coolest part.

您可以通过更改名称来重命名个人资料。 在这里,我将发布个人资料命名为“生产”。 有最酷的部分。

tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

I can make a Web.config file with the same name as my Publish Profile and that transform will be run after the build transform.

我可以使用与“发布配置文件”相同的名称制作一个Web.config文件,并且该转换将在构建转换之后运行。

Even better you can right click on a Transform now and select Preview Transform and see not only the results, but a Diff of the results.

更好的是,您现在可以右键单击“转换”,然后选择“预览转换”,不仅可以看到结果,还可以看到结果的差异。

tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

See right there, and in the large image above? It says "Transformed Web.config ( transforms applied: Web.Release.config, Web.Production.config)." Build transforms happen first, then Publish Transforms. Right now you need to create the file with the same name yourself but we'll be adding tooling for this.

在那看到,在上面的大图中? 它说:“已转换的Web.config(已应用转换:Web.Release.config,Web.Production.config)。” 构建转换首先发生,然后发布发布。 现在,您需要自己创建一个具有相同名称的文件,但是我们将为此添加工具。

This means I can do things in Web.debug.config like changing compilation options while Web.production.config is for changing connection strings, setting log levels, and adding specific Production settings.

这意味着我可以在Web.debug.config中执行某些操作,例如更改编译选项,而Web.production.config用于更改连接字符串,设置日志级别并添加特定的Production设置。

从命令行部署 (Deploying from the Command Line)

Deploying your web application from the command line has long been possible but it's been a pretty obscure and frustrating affair. Now that the Publish Profiles can live with the project and Web.config transforms can be chained in you can publish from the command line much easier.

长期以来,可以从命令行部署Web应用程序,但这是一件非常晦涩而令人沮丧的事情。 现在,“发布配置文件”可以与项目一起使用,并且可以链接Web.config转换,您可以从命令行更轻松地进行发布。

msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=Production;Password=poo msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=Production;Password=poo

If you have a untrusted certificate on the deployment server you haven't added to your local certs you'll need to add AllowUntrustedCertificate=true as an acknowledgement.

如果您在部署服务器上拥有不受信任的证书,则尚未将其添加到本地证书中,则需要添加AllowUntrustedCertificate = true作为确认。

I just make a Deploy.bat that looks like this with a %1 for the Profile Name.

我只是制作一个Deploy.bat ,看起来像这样,配置文件名称为%1。

msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=%1;AllowUntrustedCertificate=true;Password=poo msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=%1;AllowUntrustedCertificate=true;Password=poo

Then I can just do

那我就可以

Deploy Production Deploy Production

or

要么

Deploy Staging Deploy Staging

I've found these outwardly small but impactful changes have made it a lot easier for me to deploy sites. Deployment shouldn't be hard. I stand by my original statement: If you are using XCopy (or Windows Explorer or FileZilla) to deploy your website, you're doing it wrong.

我发现这些微小但有影响的更改使我更轻松地部署站点。 部署不难。 我支持我的原始声明:如果您使用XCopy(或Windows Explorer或FileZilla)来部署您的网站,那是错的。

If you are using Web Sites rather than Web Products, head over to the Web Team blog (and subscribe, too) and add your voice to the comments around our teams' plans regarding Website projects and Web Deployment Projects.

如果您使用的是网站而不是Web产品,请转到Web团队博客(也可以订阅),并在我们的团队有关网站项目和Web部署项目计划的评论中添加您的声音。

关于斯科特 (About Scott)

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

斯科特·汉塞尔曼(Scott Hanselman)是前教授,前金融首席架构师,现在是演讲者,顾问,父亲,糖尿病患者和Microsoft员工。 他是一位失败的单口相声漫画家,一个玉米种植者和一本书的作者。

tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...
tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...
tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...
About   关于 Newsletter 时事通讯
Hosting By 主持人
tiny-cnn vs应用_Tiny Happy功能#3-从命令行发布改进,链接的配置转换和部署ASP.NET应用程序...

翻译自: https://www.hanselman.com/blog/tiny-happy-features-3-publishing-improvements-chained-config-transforms-and-deploying-aspnet-apps-from-the-command-line

tiny-cnn vs应用