Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Running a script from within Visual Studio?

Reply
 
Old 08-14-2008   #1 (permalink)
Duncan Smith


 
 

Running a script from within Visual Studio?

I'm about to write some PS to do most of the grunt work of porting Cpp/
CLI functions into C# functions. Most of the steps are simple string
substitutions like so:

:: to .
System::Object^ to Object^
Object^ to object
^ to
System.Void to void
-> to .
L" to "
gcnew to new

but removing xxx_cast<>() may require some careful RegEx work (hence
my need for PS).

My first thoughts are to write a function in $profile that copies the
contents of the clipboard, transforms the code and then writes the
transformed code back to the clipboard. Calling this shouldn't be too
much of a burden - but I was just checking to see if there are any
better options available, like a context menu-item in VS to call a PS
script/host perhaps?

Many thanks,

Duncan

My System SpecsSystem Spec
Old 08-14-2008   #2 (permalink)
Keith Hill [MVP]


 
 

Re: Running a script from within Visual Studio?

"Duncan Smith" <DSmith1974@xxxxxx> wrote in message
news:0f55e3ed-9a2c-4b6b-9368-d7b761591717@xxxxxx
Quote:

> I'm about to write some PS to do most of the grunt work of porting Cpp/
> CLI functions into C# functions. Most of the steps are simple string
> substitutions like so:
>
> :: to .
> System::Object^ to Object^
> Object^ to object
> ^ to
> System.Void to void
> -> to .
> L" to "
> gcnew to new
>
> but removing xxx_cast<>() may require some careful RegEx work (hence
> my need for PS).
>
> My first thoughts are to write a function in $profile that copies the
> contents of the clipboard, transforms the code and then writes the
> transformed code back to the clipboard. Calling this shouldn't be too
> much of a burden - but I was just checking to see if there are any
> better options available, like a context menu-item in VS to call a PS
> script/host perhaps?
Two thoughts come to mind. First, you could do this just using VS's Search
& Replace functionality. It supports regular expressions although the
syntax is non-standard. I've done this before by recording a search&replace
session and then editing the resulting VBA script file to suit my needs. I
did this for NUnit 1.x to 2.x where a lot changed and required significant
changes to the source code. Second, you could process these CPP files
outside of VS using a normal PowerShell script. I've done this to process
hundreds of VC++ project files that needed certain settings tweaked (and I
wasn't about to do it by hand).

--
Keith

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Code compiled on old visual studio. Running VS2008 Pro now .NET General
Visual Studio Shuts Down Unexpectedly When Loading Project - ASP.NET Web Application running against IIS .NET General
Err.Number 486, Vista Ultimate, Visual Studio, & Visual Basic Vista General
Visual Studio 6 setup is not running in windows vista businees RC1 Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46