notNullGothik
notNullGothik

Reputation: 432

How to find a project in the tree?

Am very noob with VBasic but here we go. I want to locate a project reference inside my solution in a VStudio 2010 environment using the macros. This proj will be used to add new items, use its path for the new file.

In my solution, there use several virtual folders, when I tried to iterate through all the tree I failed to go down deep to the leaves. Has someone done that?

Later I tried gathering the project reference by using its name:

StartupProj = DTE.Solution.Item("MySpecialProj.uniquext")

But all i get is this error

The parameter is incorrect. (Exception from HRESULT:0x80070057 (E:INVALIDARG))

Googling it, found that it is correct way, but no luck finding why I get this error. Anyone helping me here?

Upvotes: 0

Views: 169

Answers (2)

Jeremy Thompson
Jeremy Thompson

Reputation: 65702

If you want to find out all selected project's & DLL references you can use:

Private _applicationObject As DTE2

Public Sub OnConnection(application As Object, connectMode As ext_ConnectMode, addInInst As Object, ByRef [custom] As Array)
    _applicationObject = DirectCast(application, DTE2)
End Sub

...

For Each project As Project In DirectCast(_applicationObject.ActiveSolutionProjects, Object())
    Dim vsProject As VSProject = TryCast(project.[Object], VSProject)
    If vsProject <> Nothing Then            
        For Each reference As Reference In vsProject.References
            ' Do cool stuff here
        Next
    End If
Next

You need to find and include a reference to VSLangProj.dll (e.g. in Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies)

Upvotes: 0

Dayan
Dayan

Reputation: 8031

Hope this helps:

Solution: Clear out the temporary framework files for your project in:

For Windows 7, the path is: C:\Users[username]\AppData\Local\Temp\Temporary ASP.NET Files\

For 64 bit systems with 'Framework' in the path the full path is: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\

Reference: http://www.solutioncottage.com/ShowSolution.aspx?solID=59

Note: doing a search on the error code on google normally yields some great results ;-)

Edit: Regarding googling the hexidecimal Error Code. I recommend its better to use the Microsoft Error Utility. You download the tool, put the exe in your system32 folder. Then open CMD and run the command err 0x80070057. It will tell you the error in the Operating System header files. Its much easiler to google these text messages along with the hex code. ps putting the exe in the system32 folder means you can run CMD from any directory in the command window.

Here is the result with the output ported to a text file: err 0x80070057 > C:\NotNullGothjik.txt

# for hex 0x80070057 / decimal -2147024809 :
  COR_E_ARGUMENT                                                corerror.h     
# MessageText: 
# An argument does not meet the contract of the method.
  DDERR_INVALIDPARAMS                                           ddraw.h        
  DIERR_INVALIDPARAM                                            dinput.h       
  DPERR_INVALIDPARAM                                            dplay.h        
  DPERR_INVALIDPARAMS                                           dplay.h        
  DPNERR_INVALIDPARAM                                           dplay8.h       
  DSERR_INVALIDPARAM                                            dsound.h       
  DVERR_INVALIDPARAM                                            dvoice.h       
  ecInvalidParam                                                ec.h           
  ecInvalidSession                                              ec.h           
  ecBadBuffer                                                   ec.h           
  MAPI_E_INVALID_PARAMETER                                      mapicode.h     
  STIERR_INVALID_PARAM                                          stierr.h       
  E_INVALIDARG                                                  winerror.h     
# One or more arguments are invalid
# 14 matches found for "0x80070057"

Upvotes: 1

Related Questions