你知道,微软的下一个"大"和"企业"的东西.
它只是我,还是人类真的难道?主要亮点是(IMO):
-skip:objectName=filePath,absolutePath=App_Offline.*仅用于跳过App_Offline.html)当然,MSDeploy和MSDeployAgent非常强大,但对于相对简单的任务,他们真的需要那么复杂吗?
是否有任何工具或Visual Studio 2010扩展允许我查看配置文件转换的输出,而不必发布整个项目?执行转换的过程是否可以直接调用?
编辑
经过一番谷歌搜索,我发现了这个:
步骤4:从命令行为"Staging"环境生成新的转换后的web.config文件
通过转到开始 - >程序文件 - > Visual Studio v10.0 - > Visual Studio工具 - > Visual Studio 10.0命令提示符打开Visual Studio命令提示符
键入"MSBuild"应用程序项目文件的路径(.csproj/.vbproj)"/ t:TransformWebConfig/p:Configuration = Staging"并按Enter键,如下所示:
转换成功后,"Staging"配置的web.config将存储在项目根目录下的obj - > Staging文件夹下(在解决方案资源管理器中,您可以通过首先取消隐藏隐藏文件来访问此文件夹):
- 在解决方案资源管理器中,单击按钮以显示隐藏文件
- 打开Obj文件夹
- 导航到您的活动配置(在我们当前的情况下,它是"暂存")
- 你可以在那里找到转换后的web.config
您现在可以验证生成的新staging web.config文件是否具有已更改的连接字符串部分.
这对我来说并不是一个完美的解决方案,因为它仍然需要构建整个项目 - 至少使用他发布的命令.如果有人知道如何跳过使用MSBuild命令的构建步骤会有所帮助(尽管听起来有点不太可能).
编辑2
我还在CodePlex上找到了这个配置转换工具,它提供了一些很好的功能来扩展转换过程.这个工具是我所见过的最接近我正在寻找的功能的工具,并且是开发创建预览的扩展的一个很好的起点.它使用Microsoft.Web.Publishing.Tasks库来执行转换,而不依赖于构建实际项目.
web-config configuration-files visual-studio-2010 slowcheetah
从我的.csproj文件:
<Content Include="log4net.config">
<SubType>Designer</SubType>
</Content>
<Content Include="log4net.Release.config">
<DependentUpon>log4net.config</DependentUpon>
</Content>
<Content Include="log4net.Debug.config">
<DependentUpon>log4net.config</DependentUpon>
</Content>
<Content Include="log4net.Live.config">
<DependentUpon>log4net.config</DependentUpon>
</Content>
<Content Include="log4net.Demo.config">
<DependentUpon>log4net.config</DependentUpon>
</Content>
Run Code Online (Sandbox Code Playgroud)
在我的.csproj文件的底部:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<Target Name="AfterCompile" Condition="exists('log4net.$(Configuration).config')">
<TransformXml Source="log4net.config"
Destination="$(IntermediateOutputPath)$(TargetFileName).config"
Transform="log4net.$(Configuration).config" />
<ItemGroup>
<AppConfigWithTargetPath Remove="log4net.config"/>
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
Run Code Online (Sandbox Code Playgroud)
来自log4net.config
<connectionString name="ConnName"
value="Data Source=localhost\sqlexpress;Initial Catalog=localdb;Persist Security Info=True;Integrated Security=SSPI;" />
Run Code Online (Sandbox Code Playgroud)
从log4net.Live.config(删除敏感数据)
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionString name="ConnName" value="Data Source=127.0.0.1;Initial Catalog=DBName;Persist Security Info=True;User ID=userid;Password=pword"
providerName="System.Data.SqlClient" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</configuration>
Run Code Online (Sandbox Code Playgroud)
我检查了msbuild输出,我看到它正确地转换了我的web.config,但我看到没有输出它转换log4net.此外,当我在发布后检查log4net.config文件时,它具有原始连接字符串.
我究竟做错了什么 :)?
谢谢!
更新 …
asp.net msbuild configuration visual-studio-2010 slowcheetah
免责声明:我知道如果我选中"在目的地保留额外文件"复选框,我可以保留文件夹权限,但我不想这样做.
也就是说,有没有办法让Visual Studio 2010中的一键式Web发布保留远程服务器上文件夹的权限?
具体来说,我希望应用程序池帐户具有对App_Data文件夹的修改权限,但在发布过程中始终会重置权限.
asp.net iis visual-studio-2010 msdeploy one-click-web-publishing
我通常把我的连接字符串放到一个单独的文件中,在web.config中添加这样的东西:
<connectionStrings configSource="WebConnection.config" />
Run Code Online (Sandbox Code Playgroud)
我刚刚安装了VS 2012,它会自动获取我现有的发布设置.但是,当我进行网络发布时,它现在自己添加了两个连接字符串,因此部署目标上的web.config现在看起来像这样:
<connectionStrings configSource="WebConnection.config">
<add name="EF.Model.DbContext" connectionString="EF.Model.DbContext_ConnectionString" providerName="System.Data.SqlClient" />
<add name="Migrations.Db.MigrationDb" connectionString="Migrations.Db.MigrationDb_ConnectionString" providerName="System.Data.SqlClient" />
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
当然,这会产生错误(使用时节点内容必须为空configSource).我注意到,在新生成的.pubxml文件(现在存储发布设置)中有以下几行:
<ItemGroup>
<_ConnectionStringsToInsert Include="EF.Model.DbContext" />
<_ConnectionStringsToInsert Include="Migrations.Db.MigrationDb" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
我该如何删除它们?:)如果我从文件中删除它们,Web-publish对话框会在我编辑发布设置时随时添加它们.
msdeploy one-click-web-publishing webdeploy visual-studio-2012
我需要一组需要为整个解决方案执行一次的任务.这将运行将修改每个项目的任务,以便为每个项目运行一组单独的任务.我们之前已经使用一个单独的项目来完成这个解决方案,该解决方案具有解决方案级别的任务,但我们希望摆脱这一点.有没有人这样做过,或者有没有人对如何实现这个有任何建议?
我认识到Web Deployment Projects不支持Visual Studio 2012.看完这篇文章后,我试着开始Publish Profiles工作.
安装Visual Studio Web发布更新后,我能够使用新的发布对话框发布网站项目和Web应用程序项目Visual Studio 2012.
因为我们正在使用TFS 2010 Team Build我试图通过MSBuild参数使用发布配置文件.但以下语句仅适用于发布Web应用程序项目.
MSBuild.exe MyWebs.sln /p:Configuration=Release /p:DeployOnBuild=true;PublishProfile=DeployToDirectory.pubxml
Run Code Online (Sandbox Code Playgroud)
如果我尝试发布网站项目没有任何反应.我的网站项目的发布配置文件仅适用于新的发布对话框,Visual Studio 2012但不适用于调用时MSBuild.
任何的想法?
我已经在我的web.config中为我的connectionStrings等设置了一些配置转换.但是我已将web.config的某些区域分离为单独的文件,例如appSettings.config.
如何配置Visual Studio和MSBuild以对这些附加配置文件执行配置转换?
我已经按照web.config的方法在我的Web应用程序项目文件中将文件关联在一起,但不会自动应用转换.
<ItemGroup>
<Content Include="appSettings.Debug.config">
<DependentUpon>appSettings.config</DependentUpon>
</Content>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud) 当我使用Visual Studio发布我的软件时,它会生成.deploy扩展名.比如my_program.exe.deploy是什么?它是干什么用的
我正在尝试将一个简单的Ruby on Rails应用程序部署到dreamhost但是我收到了与bundle命令相关的错误.这是错误:
servers: ["bullseye.dreamhost.com"]
[bullseye.dreamhost.com] executing command
command finished
* executing "find /home/USER-NAME/MY-DOMAIN/releases/20110123014150/public/images /home/USER-NAME/MY-DOMAIN/releases/20110123014150/public/stylesheets /home/USER-NAME/MY-DOMAIN/releases/20110123014150/public/javascripts -exec touch -t 201101230141.52 {} ';'; true"
servers: ["bullseye.dreamhost.com"]
[bullseye.dreamhost.com] executing command
command finished
triggering after callbacks for `deploy:update_code'
* executing `bundle:install'
* executing "ls -xt /home/USER-NAME/MY-DOMAIN/releases"
servers: ["bullseye.dreamhost.com"]
[bullseye.dreamhost.com] executing command
command finished
* executing "bundle install --gemfile /home/USER-NAME/MY-DOMAIN/releases/20110123014150/Gemfile --path /home/USER-NAME/MY-DOMAIN/shared/bundle --deployment --quiet --without development test"
servers: ["bullseye.dreamhost.com"]
[bullseye.dreamhost.com] executing command
*** [err :: bullseye.dreamhost.com] sh: bundle: command not found
command finished
*** …Run Code Online (Sandbox Code Playgroud) msbuild ×4
msdeploy ×4
slowcheetah ×3
asp.net ×2
web-config ×2
bundler ×1
c# ×1
capistrano ×1
deployment ×1
dreamhost ×1
iis ×1
webdeploy ×1