从命令行发布ClickOnce [英] Publish ClickOnce from the command line
问题描述
是否可以让Visual Studio 2008从命令行执行立即发布"按钮?
Is there a way to have Visual Studio 2008 execute the "Publish Now" button from the command line?
我见过一些建议使用 msbuild/target:publish 进行调用的帖子.可以,但是MSBuild不会增加修订号.我希望有这样的东西:
I've seen posts that suggest to use msbuild /target:publish to call it. That is OK, but MSBuild doesn't increment the revision number. I'm hoping for something like:
devenv mysolution.sln /publish
推荐答案
要增加内部版本号,我正在使用 MSBuild扩展在我的.csproj文件中打包,如下所示:
To increment build numbers, I am using MSBuild Extension pack inside my .csproj file as follows:
<Target Name="BeforeBuild" Condition=" '$(Configuration)|$(Platform)' == 'Release-VersionIncrement|AnyCPU' ">
<CallTarget Targets="CleanAppBinFolder" />
<MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkout" ItemCol="@(AssemblyInfoFiles)" WorkingDirectory="C:\inetpub\wwwroot\MySolution" ContinueOnError="true" />
<!-- Microsoft's task that goes over assembly files and increments revision number. -->
<MSBuild.ExtensionPack.Framework.AssemblyInfo Condition="'$(Optimize)'=='True' " AssemblyInfoFiles="@(AssemblyInfoFiles)" AssemblyRevisionType="AutoIncrement" AssemblyFileRevisionType="AutoIncrement">
<Output TaskParameter="MaxAssemblyVersion" PropertyName="MaxAssemblyVersion" />
</MSBuild.ExtensionPack.Framework.AssemblyInfo>
<Message Text="----current version---: '$(MaxAssemblyVersion)'" />
</Target>
这样,只要将配置设置为Release-VersionIncrement,就可以更改版本号.完成此操作后,我可以使用以下MSBuild命令来发布它:
This way, anytime the configuration is set to Release-VersionIncrement, the version number is changed. When this is done, I can use the following MSBuild command to publish it:
msbuild c:\ projects \ MyProject.csproj /t:ResolveReferences; _CopyWebApplication /p:配置=发布; BuildingProject = true; WebProjectOutputDir = c:\ inetpub \ wwwroot \ OutputProject \ MyProjectOutput; OutDir = c:\ inetpub \ wwwroot \ OutputProject \ MyProjectOutput
msbuild c:\projects\MyProject.csproj /t:ResolveReferences;_CopyWebApplication /p:Configuration=Release;BuildingProject=true;WebProjectOutputDir=c:\inetpub\wwwroot\OutputProject\MyProjectOutput;OutDir=c:\inetpub\wwwroot\OutputProject\MyProjectOutput
请注意,这是针对ASP.NET 3.5 Web应用程序的.
Note that this is for an ASP.NET 3.5 web application.
这篇关于从命令行发布ClickOnce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!