如何在Visual Studio 2010 32 Bits中的通过Project的Post-build Event执行 64bits的PowerShell
应用背景:
一些PowserShell Scripts需要在64 bits windows powershell中执行,例如一些SharePoint 2010的操作。Google在stackoverflow中查到方法,成功运用
Because of file system virtualization, you can't really specify the path to the 64-bit version of PowerShell from a 32-bit process (ie Visual Studio - which hosts the msbuild engine). One hack-ish way to work around this is to create a 64-bit launcher that runs as 64-bit and will launch the 64-bit version of PowerShell. Here's a simple C# program that will do this:
using System;
using System.Diagnostics;class App
{static int Main(string[] args){Process process = Process.Start("PowerShell.exe", String.Join(" ", args));process.WaitForExit();return process.ExitCode;}
}
Be sure to compile this as 64-bit like so:
csc .\PowerShell64.cs /platform:x64
Then, from your post-build event execute this launcher exe passing it the parameters you want to invoke 64-bit PowerShell with. Also, with PowerShell 2.0 I would recommend using the File
parameter to execute a script e.g.:
c:\path\PowerShell64.exe -File "$(MSBuildProjectDirectory)\CreateSite.ps1" auto
That said, surely there has to be some other way (utility) that launches exes from a 64-bit process.
转载于:https://www.cnblogs.com/iddie/archive/2011/07/26/2117673.html
如何在Visual Studio 2010 32 Bits中的通过Project的Post-build Event执行 64bits的PowerShell相关推荐
- c语言中TR1=1什么意思,c – 如何在Visual Studio 2010(tr1 :: function)中使用tr1?
如何开始使用Visual Studio 2010的tr1功能?对于更具体的情况,我需要std :: tr1 :: function.我试过包括#include< tr1 / functional ...
- 【转】【UML】使用Visual Studio 2010 Team System中的架构师工具(设计与建模)
Lab 1: 应用程序建模 实验目标 这个实验的目的是展示如何在Visual Studio 2010旗舰版中进行应用程序建模.团队中的架构师会通过建模确定应用程序是否满足客户的需求. 你可以创建不同级 ...
- 如何在Visual Studio 2010中使用CppUTest建立TDD的Code Kata的环境
CppUTest 是一个功能全面的测试框架,是为了支持在多种操作系统上开发嵌入式软件而特别设计的.CppUTest的宏被设计成不需要了解C++也可以写测试用例.这使得C程序员更容易用这个测试框架. 那 ...
- Visual Studio 2010在简洁中强调团队合作
Visual Studio 2010警告用户Silverlight项目会出现安全风险,并提供了两种项目模式.其次,Visual Studio 2010更加讲求团队精神. 开发更具有强大功能与简洁的 ...
- 图解Visual Studio 2010中的UML建模功能
Visual Studio 2010在架构和项目管理方面的功能增加让人眼前一亮,之前曾详细介绍过Visual Studio 2010新增的架构工具,包括通过可视化技术DGML提供直观的图表,依赖图,继 ...
- 详解Visual Studio 2010中QT环境搭建配置
本文将介绍如何在Visual Studio 2010中配置Qt这个跨平台应用程序和UI开发框架. QT简介 Qt是一个跨平台应用程序和UI开发框架.它包括跨平台类库.集成开发工具和跨平台 IDE.使用 ...
- Visual Studio 2010中C++项目升级指南
如何升级? Visual Studio 2010支持来自VC6.Visual Studio 2002.Visual Studio 2003.Visual Studio 2005和Visual Stud ...
- 使用Visual Studio 2010开发和调试Html5项目
上周有幸参加微软技术大会(TechED2010),身临其境领略微软这样的国际化公司大家风范,云加端的概念将技术思维提到的一个新的档次,此行收获很大,在第一天谢恩伟提到正在进行的IE9开发大赛让我很是关 ...
- 我眼中的Visual Studio 2010架构工具
影响架构质量的是构建体系架构的思想.原则.实践与架构师的经验,绝不是工具.即使是最优秀的架构工具,也不可能像倚天宝剑一般--倚天一出,谁与争锋--似乎谁握住了这把利刃,就能够成为武林盟主.架构工具可以 ...
最新文章
- mysql 创建函数问题
- Jmeter性能测试之ForEach控制器的使用
- 这是阿里技术专家对 SRE 和稳定性保障的理解
- 【必懂】C语言水仙花数题解
- qt5 窗体显示完毕信号_iPhone手机信号不好?试试这样设置,随时随地让你的手机信号满格...
- c#web页面显示弹窗_基于 HTML5 WebGL 的 3D 风机 Web 组态工业互联网应用
- @Service @Autowired
- 语言常用c100单词,英语口语练习_夏普新款PW-C100-G电子词典测评_沪江英语
- ThreadPoolExecutor的应用和实现分析(中)—— 任务处理相关源码分析 线程利用(转)...
- avast! Virus Cleaner 1.0.210
- 自制QQ机器人插件笔记[nonebot2部署于ubuntu系统服务器]
- 内存为程序分配空间的四种分配方式
- ASP.NET MVC 上传文件方法
- win10删除第三方增加的“设备和驱动器”
- ps快捷键对应的英文字母缩写
- 第一节计算机课开场白,第一节课有趣的开场白
- O - 期末考试之分等级
- 01.swagger
- 利用VTP协议实现交换机 VLAN配置的一致性
- 商业图表软件--SmartDraw 7