从脚本文件运行时 Mage.exe 出现问题
我正在自动化产品的 ClickOnce 部署。我正在使用 ANT 构建脚本,但遇到了一个无法找到答案的问题。我可以构建我的项目并将所需的文件(EXE、DLL 等)复制到暂存目录。我可以打开命令提示符并手动运行 mage.exe 并生成并签署应用程序和部署清单。这为我提供了一个可以安装和运行的工作部署。当我尝试使用 ANT 脚本自动执行此操作时,问题就出现了。我编译了产品并复制它就很好。在创建应用程序清单时,每个文件都会出现以下错误:
警告 MSB3178:程序集 { assemblyName} 被错误地指定为文件。
请记住,使用了完全相同的 mage 命令,但是当我从脚本运行它时,我收到此警告,这实际上是一个错误。由于此错误,应用程序清单文件无效,我的产品无法安装在用户计算机上。再次,如果我在命令提示符中手动键入相同的命令,那么它会起作用并且我的部署很棒,但从我的脚本来看它不起作用。所有属性均已验证正确,所有路径也均正确。我还尝试使用所有硬编码值(无属性)运行命令,但错误仍然存在。
任何帮助将不胜感激。
<target name="foo">
<exec executable='${mage}'>
<arg line='-New Application
-Processor x86
-ToFile 'D:\BuildSynch\ClickOnce\TabletMPE\1.0.0.0\TabletMPE.exe.manifest'
-name 'TabletMPE'
-Version 1.0.0.0
-FromDirectory '1.0.0.0'"/>
</exec>
</target>
I am in the process of automating a ClickOnce deployment of a product. I am using ANT for a build script and I am running into a problem that I cannot find an answer to. I can build my project and copy the needed files (EXEs, DLLs, etc.) to a staging directory. I can open the command prompt and manually run mage.exe and generate and sign both the application and deployment manifest. This gives me a working deployment that will install and run. The problem comes when I try to automate this with an ANT script. I compile the product and copy it just fine. When it comes to creating the application manifest I get the following error for every file:
Warning MSB3178: Assembly {assemblyName} is incorrectly specified as a file.
Keep in mind that the exact same mage command is used, but when I run it from a script I get this warning, which is really an error in the end. Because of this error that application manifest file is invalid and my product won't install on a users machine. Once again, if I manually type the same command in the command prompt then it works and my deployment is great, but from my script it is not working. All of the properties are verified to be correct and all paths are also correct. I have also tried to run the commands with all hardcoded values (no properties) and the errors persist.
Any help would be appreciated.
<target name="foo">
<exec executable='${mage}'>
<arg line='-New Application
-Processor x86
-ToFile 'D:\BuildSynch\ClickOnce\TabletMPE\1.0.0.0\TabletMPE.exe.manifest'
-name 'TabletMPE'
-Version 1.0.0.0
-FromDirectory '1.0.0.0'"/>
</exec>
</target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的代码对我来说肯定不正确。我会尝试这个:
此外,您应该尝试使用
因为它是 强烈推荐。Your code certainly does not seem correct to me. I would try this :
In addition you should try to use the
<arg value=""/>
as it is highly recommended in the ant manual.