English 中文(简体)
age是什么?
原标题:What is Mage and in what way is it useful?
  • 时间:2009-09-26 07:02:40
  •  标签:

我不断看到有关Mage的提法,但我不明白它做了些什么,为什么它有用/流行。 如果有人能够迅速缩编,那将非常感激!

问题回答

Mitch Wheat做了大量回答,如果你刚从Mage开始,就翻了他给的最后一个环节!

我想分享一些真实的法典,以便让其他人帮助开展他们的ClickOnce项目。 I ve found that using 从指挥线到“create”部署<的微型、小型和中型计算机辅助器,对自动建筑过程是完美的。 页: 1 虽然我的确只字未提一下在瓦索邦的东岸情况,因此我不必从指挥线上这样做。 例如,“申请档案”是我不知道如何在指挥线上这样做的。

在申请被成功应用后,N在服务器上部署...... 我将“Mage”作为我从一个服务器向另一个服务器(例如:测试和模拟;升级)迁移工作的一部分。

例如(A PowerShell 写着你从游轮工作获得的解决办法):

&"$Env:windirMicrosoft.NETFramework64v4.0.30319msbuild.exe" "C:ProjectsMyCoolApp.sln" /t:clean /t:publish /p:Configuration=Release /p:ApplicationRevision=$Env:CCNETLABEL /p:PublishDir="\TestServerMyCoolAppFolder/" /p:PublishUrl="\TestServerMyCoolAppFolder/"

之后,当你想将我们的ClickOnce申请从“试验Server”移至“QAServer”或“统计”或“介绍”时,你需要写一份复杂的文字来做。 这里我要谈谈:

#########################################################################################
# PowerShell Script to Migrate a ClickOnce Deployment from one server to another.
# This is my first attempt at PowerShell... pardon the bad or incorrect code. :-)
# To run a PowerShell script from CruiseControl.Net:
# http://www.cruisecontrolnet.org/projects/ccnet/wiki/PowerShell_Task
# NOTE: When doing the initial build, ensure that the ProviderURL and ProviderDir are set.
#########################################################################################

$SourceDir = "\TestServerMyCoolAppFolder"
$DestDir = "\StagingServerMyCoolAppFolder"
$DeploymentManifestName = "MyCoolApp.application"
$DeploymentDestUrl = "file://StagingServer/MyCoolAppFolder"

# If your application is one that connects to a database, then likely you want it to point 
# to a different database depending what environment it s been deployed to.
# I use a SQL Server connection for this example.
$ConnStringName = "MyCoolAppConnectionString"
$ConnStringValue = "data source=StagingServerInstance;Initial Catalog=MyCoolAppDB;persist security info=True;user id=Gregg;password=Gregg"

# Unfortunately, you *must* specify the publisher when doing Mage, even though you specified it
# when you did the original publish, otherwise Mage will change the Publisher value to the 
# name of your Application. A bug in Mage I suspect.
$Publisher = "Gregg Cleland" 

# Risk: This next line assumes that the pfx certificate file is readily available.
# Just be certain it s the same key you used when you published originally.
$AuthenticationKeyPath = "C:ProjectsMyCoolAppMyCoolApp_TemporaryKey.pfx"

# Note: This references the .NET 3.5 version of mage... the .NET 4.0 version of mage.exe can be found at:
# C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinNETFX 4.0 Toolsmage.exe
$MAGE = "C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinmage.exe"

#########################################################################################
# Start off at the source location.
Set-Location $SourceDir

#########################################################################################
# Get the application manifest directory name and application manifest file name.
[xml]$doc = Get-Content $DeploymentManifestName
$ns = New-Object Xml.XmlNamespaceManager $doc.NameTable
$ns.AddNamespace( "asmv1", "urn:schemas-microsoft-com:asm.v1" )
$ns.AddNamespace( "asmv2", "urn:schemas-microsoft-com:asm.v2" )
$xpath = "/asmv1:assembly/asmv2:dependency/asmv2:dependentAssembly" 
$appManifestPath = $doc.SelectSingleNode( $xpath, $ns ).codebase # Example: = "Application FilesMyCoolApp_1_0_0_5MyApp.exe.manifest"
$position = $appManifestPath.LastIndexOf(  );
$appManifestDir = $appManifestPath.SubString(0, $position); # Example: "Application FilesMyCoolApp_1_0_0_5"
$appManifestFile = $appManifestPath.SubString($position + 1); # Example: "MyCoolApp.exe.manifest"

#########################################################################################
# Copy the deployment files and the latest application files to destination.
# Note: Do not forget to ensure the CruiseControl Service Logon has permissions to write to destination!
# Todo: If robocopy fails, throw "robocopy failed!" Most likely it is an Error 5, Access Denied 
# b/c the CruiseControl Service logon account doesn t have permission to copy to create/write to destination.
$CurrentDir = "$DestDir$appManifestDir"
robocopy "$SourceDir" "$DestDir" /XO
robocopy "$SourceDir$appManifestDir" $CurrentDir /MIR /XO

#########################################################################################
# Now that we have copied the latest build, let us navigate down into the destination s
# application manifest directory and do some work.
Set-Location $CurrentDir

#########################################################################################
# Remove the .deploy extension from all files. (Mage will throw an exception if you don t do this)
Get-ChildItem -Include *.deploy -Recurse | Rename-Item -NewName { [System.IO.Path]::ChangeExtension($_.Name, "") }

#########################################################################################
# Modify the XML in the app.config file per your needs (e.g. change the connectionStrings)
[xml]$doc = Get-Content $AppConfigFileName

$node = $doc.SelectSingleNode("configuration/connectionStrings/add[@name= $ConnStringName ]")
$node.connectionString = $ConnStringValue

$xmldocPath = $PWD.ProviderPath # hack to avoid getting the silly namespace prefixed to the path for UNC paths
$doc.Save("$xmldocPath$AppConfigFileName") # For some reason, seems to require the fully qualified path

#########################################################################################
# Finally... We get to the part where we use MAGE!
# Use MAGE to update the application manifest hash and sign it.
&"$MAGE" -Update $appManifestFile -FromDirectory "$CurrentDir" -CertFile $AuthenticationKeyPath

#########################################################################################
# Re-Add the ".deploy" extension to all files EXCEPT those that end in "application" or 
# "manifest". Do this AFTER signing.
Get-ChildItem -Recurse | Where-Object { !$_.PSIsContainer -and !$_.Name.EndsWith(".application") -and !$_.Name.EndsWith(".manifest") } | Rename-Item -NewName { $_.Name + ".deploy" }

#########################################################################################
# Finally, go back up to the Deployment folder and update the deployment manifest
Set-Location "...."
&"$MAGE" -Update $DeploymentManifestName -ProviderUrl "$DeploymentDestUrl/$DeploymentManifestName" -AppManifest "$appManifestPath" -Publisher $Publisher -CertFile $AuthenticationKeyPath

http://msdn.microsoft.com/en-us/library/acz3y3te(VS.80).aspx” rel=“noreferer”>Mage.exe是《网络框架》应用的一种Manifest Generation和编辑指令工具。 http://msdn.microsoft.com/en-us/library/xhctdw55(VS.80).aspx“rel=“noreferer”>。

一种典型用途是人工生成

用于签署点击申请





相关问题