VS 2002 vs. VS 2003 wizard problem

  • Thread starter Thread starter Rafael Campana
  • Start date Start date
R

Rafael Campana

Hi,

I posted the messsage below last week, but no replies,
I've reproduced the problem with a VB macro, just create
one and paste the following code. Let me know of any
workarounds you can think of.
thanks,
-R a f i

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
Sub TestRelPath()
Dim file As VCFile
Dim col As IVCCollection
Dim idx As Integer
Dim prj As VCProject
prj = DTE.Solution.Projects.Item(1).Object
col = prj.files

'Add a file relative to the TEMP environment
variable
Dim foo As VCFile = prj.AddFile("$(TEMP)\foo.h")
MsgBox(foo.FullPath)

'The following should return a path relative to
the env var not .\
MsgBox(foo.RelativePath)
foo.RelativePath = "C:\Documents and
Settings\bkretzler"
MsgBox(foo.RelativePath)

'The following statement does not set the
RelativePath
foo.RelativePath = "$(TEMP)\foo.h"
MsgBox(foo.RelativePath)
End Sub
End Module



----------------------------------------------
Subject: VS 2002 vs. VS 2003 wizard problem
From: "Rafi" <[email protected]> Sent: 9/10/2003
11:16:51 PM

Hi,

(not sure if this is the right newsgroup or not, please
let me know)

We've developed an add-in with wizards, etc for VS 2002,
and worked without a problem. The changes has been made
for it to work with VS 2003, but there's a roadblock that
can't get around.
The wizards adds some files to the project relative to an
environment variable for example: "$(TEMP)\foo.c". This
is shipping to customers and works great in VS 2002, now
in VS 2003 it does not work, after the wizard (no code
has changed) finishes, the relative path is ".\$(TEMP)
\foo.c" which breaks everything. I was able to modify
manually the .vcproj after it is created to be "$(TEMP)
\foo.c" and work ok, but I'd like to handle that in the
wizard, has anyone ran into this problem? any ideas,
solutions?
I've got a wizard that exhibits the problem, let me know
if you want me to send it to you all, but below is a
JScript snippet
thanks,

......
var thefile = srcFolder.AddFile(strFilePath);

// This works - get RelativePath
var filepathinfo = thefile.RelativePath;

/* Shouldn't one of the following work?: */
//thefile.RelativePath("c:\\readme.txt");
//thefile.RelativePath = "c:\\readme.txt";

/* If I can set the RelativePath I can workaround the
problem, but I can't */
 
Hi Rafael,

Thanks for posting in the group.

I noticed that you posted the question in some groups. I have replied it in
vsnet.general group. Please check my reply when you have free time. I will
follow up the post there.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Rafael Campana" <raficampana@nospam_please.com>
!Sender: "Rafael Campana" <raficampana@nospam_please.com>
!Subject: VS 2002 vs. VS 2003 wizard problem
!Date: Mon, 22 Sep 2003 12:05:15 -0700
!Lines: 85
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcOBPHTVqBIu6PgYRNS994wRcp/0yQ==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:109485
!NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
!X-Tomcat-NG: microsoft.public.dotnet.general
!
! Hi,
!
!I posted the messsage below last week, but no replies,
!I've reproduced the problem with a VB macro, just create
!one and paste the following code. Let me know of any
!workarounds you can think of.
!thanks,
! -R a f i
!
!' add reference to Microsoft.VisualStudio.VCProjectEngine
!Imports EnvDTE
!Imports Microsoft.VisualStudio.VCProjectEngine
!
!Public Module Module1
! Sub TestRelPath()
! Dim file As VCFile
! Dim col As IVCCollection
! Dim idx As Integer
! Dim prj As VCProject
! prj = DTE.Solution.Projects.Item(1).Object
! col = prj.files
!
! 'Add a file relative to the TEMP environment
!variable
! Dim foo As VCFile = prj.AddFile("$(TEMP)\foo.h")
! MsgBox(foo.FullPath)
!
! 'The following should return a path relative to
!the env var not .\
! MsgBox(foo.RelativePath)
! foo.RelativePath = "C:\Documents and
!Settings\bkretzler"
! MsgBox(foo.RelativePath)
!
! 'The following statement does not set the
!RelativePath
! foo.RelativePath = "$(TEMP)\foo.h"
! MsgBox(foo.RelativePath)
! End Sub
!End Module
!
!
!
!----------------------------------------------
!Subject: VS 2002 vs. VS 2003 wizard problem
!From: "Rafi" <[email protected]> Sent: 9/10/2003
!11:16:51 PM
!
!Hi,
!
!(not sure if this is the right newsgroup or not, please
!let me know)
!
!We've developed an add-in with wizards, etc for VS 2002,
!and worked without a problem. The changes has been made
!for it to work with VS 2003, but there's a roadblock that
!can't get around.
!The wizards adds some files to the project relative to an
!environment variable for example: "$(TEMP)\foo.c". This
!is shipping to customers and works great in VS 2002, now
!in VS 2003 it does not work, after the wizard (no code
!has changed) finishes, the relative path is ".\$(TEMP)
!\foo.c" which breaks everything. I was able to modify
!manually the .vcproj after it is created to be "$(TEMP)
!\foo.c" and work ok, but I'd like to handle that in the
!wizard, has anyone ran into this problem? any ideas,
!solutions?
!I've got a wizard that exhibits the problem, let me know
!if you want me to send it to you all, but below is a
!JScript snippet
!thanks,
!
!.....
!var thefile = srcFolder.AddFile(strFilePath);
!
!// This works - get RelativePath
!var filepathinfo = thefile.RelativePath;
!
!/* Shouldn't one of the following work?: */
!//thefile.RelativePath("c:\\readme.txt");
!//thefile.RelativePath = "c:\\readme.txt";
!
!/* If I can set the RelativePath I can workaround the
!problem, but I can't */
!
!
 
Back
Top