我使用msbuild来使用setup -url =“location”...
我使用ClickOnce发布应用程序,我想更改setup.exe中的URL。
<Exec Command="$(PublishDir)\setup -url=$(ProviderUrl)" />
另一个问题是,在使用/ url开关更改URL后,会出现手动确认签名将无法用于程序集的消息。
两个问题:
如何使用setup -url = http:// ....模式无声?我不希望这看起来像是确认的消息。
如何再次签名setup.exe?
关于它的任何解决方案?谢谢先生
我的msbuild
<Target Name="PublishClickOnce">
<Exec Command="$(PublishDir)\setup -url=$(ProviderUrl)" />
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -pu $(ProviderUrl)" />
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -cf $(CertDir)\Frk.Security.CarWin_TemporaryKey.pfx" />
</Target>
请帮忙吗?提前谢谢。
答案 0 :(得分:2)
我们如何使用TeamBuild为多个环境构建ClickOnce应用程序
您可以阅读我原来的博文here
这是您从TeamBuild项目文件中调用ClickOnce构建的方法(为了便于阅读而添加了换行符):
<Msbuild
Projects="$(SolutionRoot)\ConfigFiles\BuildClickOnce.targets"
Targets="BuildClickOnce"
Properties="SourceDir=$(SourceDir);PublishDir=$(PublishDir); ClickOnceAppName=$(ClickOnceAppName);ClickOnceExeFile=$(ClickOnceExeFile); ClickOnceProduct=$(ClickOnceProduct);Company=$(Company); ClickOnceDescription=$(ClickOnceDescription);ClickOnceUrl=$(ClickOnceUrl); VersionNumber=$(VersionNumber);SigningCert=$(SigningCert); SigningCertPassword=$(SigningCertPassword)"
/>
对于每个环境或配置更改,您希望使用它。您可以在下面找到BuildClickOnce.targets文件(为了便于阅读,添加了换行符):
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\SDC\Microsoft.Sdc.Common.tasks"/>
<Target Name="BuildClickOnce" DependsOnTargets="">
<PropertyGroup>
<ClickOnceApplicationUrl>$(ClickOnceUrl)$(ClickOnceAppName).application</ClickOnceApplicationUrl>
<AppPublishDir>$(PublishDir)</AppPublishDir>
<SdkPath>C:\Program Files\Microsoft SDKs\Windows\v6.0A</SdkPath>
</PropertyGroup>
<BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Message="Buildning $(ClickOnceAppName) ClickOnce version: $(VersionNumber)">
<Output TaskParameter="Id" PropertyName="StepId" />
</BuildStep>
<CallTarget Targets="UpdateWebPage" />
<!--
************************************************
Generate application manifest
************************************************
-->
<Exec
Command="mage.exe -New Application -TrustLevel FullTrust -ToFile "$(AppPublishDir)\$(ClickOnceExeFile).manifest" -Name "$(ClickOnceAppName)" -Version "$(VersionNumber)" -FromDirectory "$(AppPublishDir)""
WorkingDirectory="$(SdkPath)\Bin"/>
<!--
************************************************
Signing application manifest
************************************************
-->
<Exec Condition="'$(SigningCertPassword)'==''"
Command="mage.exe -Sign "$(AppPublishDir)\$(ClickOnceExeFile).manifest" -CertFile "$(SigningCert)""
WorkingDirectory="$(SdkPath)\Bin" />
<Exec Condition="'$(SigningCertPassword)'!=''"
Command="mage.exe -Sign "$(AppPublishDir)\$(ClickOnceExeFile).manifest" -CertFile "$(SigningCert)" -Password "$(SigningCertPassword)""
WorkingDirectory="$(SdkPath)\Bin"/>
<!--
************************************************
Renaming source files to .deploy
************************************************
-->
<ItemGroup>
<SourceFilesToRename Include="$(AppPublishDir)\**\*.*" Exclude="$(AppPublishDir)\*.manifest;$(AppPublishDir)\*.htm"/>
<SourceFilesToDelete Include="$(AppPublishDir)\**\*.*" Exclude="$(AppPublishDir)\*.application;$(AppPublishDir)\*.manifest;$(AppPublishDir)\*.htm"/>
</ItemGroup>
<Copy
SourceFiles="@(SourceFilesToRename)"
DestinationFiles="@(SourceFilesToRename->'$(AppPublishDir)\%(RecursiveDir)%(Filename)%(Extension).deploy')"
/>
<Delete Files="@(SourceFilesToDelete)"/>
<!--
************************************************
Generating deployment manifest
************************************************
-->
<GenerateDeploymentManifest
MapFileExtensions="true"
AssemblyName="$(ClickOnceAppName).application"
AssemblyVersion="$(VersionNumber)"
MinimumRequiredVersion="$(VersionNumber)"
DeploymentUrl="$(ClickOnceApplicationUrl)"
Description="$(ClickOnceDescription)"
Product="$(ClickOnceProduct)"
Publisher="$(Company)"
SupportUrl="$(SupportUrl)"
EntryPoint="$(AppPublishDir)\$(ClickOnceExeFile).manifest"
Install="true"
UpdateEnabled="true"
UpdateMode="Foreground"
OutputManifest="$(PublishDir)\$(ClickOnceAppName).application"/>
<!--
************************************************
Signing application manifest
************************************************
-->
<Exec Condition="'$(SigningCertPassword)'==''"
Command="mage.exe -Sign "$(PublishDir)\$(ClickOnceAppName).application" -CertFile "$(SigningCert)""
WorkingDirectory="$(SdkPath)\bin"/>
<Exec Condition="'$(SigningCertPassword)'!=''"
Command="mage.exe -Sign "$(PublishDir)\$(ClickOnceAppName).application" -CertFile "$(SigningCert)" -Password "$(SigningCertPassword)""
WorkingDirectory="$(SdkPath)\bin"/>
<!--
************************************************
Generating Bootstrapper
************************************************
-->
<ItemGroup>
<BootstrapperFile Include="Microsoft.Net.Framework.2.0">
<ProductName>Microsoft .NET Framework 2.0</ProductName>
</BootstrapperFile>
</ItemGroup>
<GenerateBootstrapper
ApplicationFile="$(ClickOnceAppName).application"
ApplicationName="$(ClickOnceAppName)"
ApplicationUrl="$(ClickOnceUrl)"
BootstrapperItems="@(BootstrapperFile)"
Culture="en"
FallbackCulture="en-US"
CopyComponents="true"
Validate="false"
Path="$(SdkPath)\Bootstrapper"
OutputPath="$(PublishDir)"/>
<BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(StepId)"
Status="Succeeded"/>
<OnError ExecuteTargets="MarkBuildStepAsFailed" />
</Target>
<!--
************************************************
Marks a buildstep as failed
************************************************
-->
<Target Name="MarkBuildStepAsFailed">
<BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(StepId)"
Status="Failed"/>
</Target>
<!--
************************************************
Updating web page
************************************************
-->
<Target Name="UpdateWebPage">
<ItemGroup>
<WebPage Include="$(PublishDir)\publish.htm" />
</ItemGroup>
<RegEx
Condition="Exists(@(WebPage))"
Path="@(WebPage)"
RegularExpression="#VERSION#"
NewValue="$(VersionNumber)"
Force="true"/>
</Target>
</Project>
答案 1 :(得分:0)
如果您想更改网址,最好不要这样做:
我发现使用-url参数使我在签名后设置无效