Which Namespace For EnvDTE? - visual-studio

I was playing with writing a Visual Studio Add-In in F# and I was following along with some stuff that Gabriel Culliver and Brian McNamara had posted in response to this question.
When I put the following code into a .fs file in VS 2010
namespace TestFSharpAddIn
open System
open Extensibility
//open EnvDTE
//open EnvDTE80
do()
It gives me the following error when I attempt to build:
The namespace or module 'Extensibility' is not defined
I have added a reference to Extensibility.dll so I'm assuming that the namespace within the Extensibility dll is not "Extensibility". But it doesn't seem to be possible to open the Extensibility dll in the Object Browser. Am I missing something obvious here? How can I find out which namespaces are present in Extensibility.dll?
I also tried this with EnvDTE with pretty much the same issue.
The project is a modified C# template (per Brian's answer) and I can comment out everything in this .fs file and it builds so I think the project/solution itself is ok. There's a second .fs file in the project which builds fine but, of course, it doesn't need to reference any of the EnvDTE or Extensibility assemblies.
EDIT:
Additional Information:
Extensibility.dll
Version 7.0.3300.0
Path: C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Extensibility.dll

I'm not sure what's going on in with your situation but I've verified this works in F#. Here are my steps
New F# application
Add a Reference to the Extensibility DLL
I then added the following code to verify the reference. It compiles cleanly.
open Extensibility
let x : IDTExtensibility2 = null
printfn "foo"
The path I used for the extensibility DLL is
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Common\Extensibility.dll

Related

Depend on DLL without header file, worked in Visual Studio 2005

I have a legacy project that used to be build in Visual C++ 2005 Express, and it depends on a certain third party DLL. As far as I can tell it doesn't come with a lib or header file.
The project compiles fine in Visual C++ 2005, here is a screenshot showing the DLL visible and browsable in the object explorer. The code can also use it without #include or anything like that, which is pretty weird.
Importing the project into Visual Studio 2019 works as well, the code can still use the DLL and it is listed under both the dependencies and the references:
I now want to achieve the same thing in a new project, but I cannot figure out how to register the DLL as a dependency. Things I found online and tried:
"Just include the header or lib file" doesn't work, I don't have one
LoadLibrary() and GetProcAddress() are awfully contrived and don't seem necessary because it's clearly possible without.
Create your own lib file doesn't work either, dumpbin doesn't show any symbols for my DLL: image
How do I register the DLL as a dependency? And where does Visual C++ 2005 get the list of methods in the DLL from is the first place?

Building C/C++ projects with ASM modules in Visual Studio 2010

I'm feeling like an eejit right now. I have been using Visual Studio 2010 Professional successfully for C/C++ projects for quite some time. But now I have a project that also includes a couple of ASM files (written for the Microsoft Assembler). I read a few articles about enabling MASM in Visual Studio. I followed the instructions for checking the boxes for MASM and MASM64 in the project's Build Customizations. Then I saved the Project and reopened it. But now it cannot load the project and gives this error message:
The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm64.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Where do I find this masm64.targets file or how do I create it? It is not anywhere on the disk.
Thanks for any guidance.
A tip for anyone who runs into the same problem, I found masm64.targets on GitHub:
https://github.com/MMOCOM/OSIE-GF/blob/master/Rules/masm64.targets

Convert SharePoint 2010 Solution to 2013 and Visual Studio 2012

I am trying to convert a SharePoint 2010 solution (custom web parts, content types, lists, event receivers, etc.) developed in Visual Studio 2010 to SharePoint 2013 and Visual Studio 2012. When I open the project in VS 2012, it converts a couple of the project files but won't compile because of reference issues.
I copied the DLLs (mostly Microsoft.SharePoint..., although I needed to copy the Microsoft.Office.SecureStoreService.dll too) that were causing issues from my 2010 server to the 2013 server and fixed the references. However, the Microsoft.Office.SecureStoreService.dll still gives me compiler errors claiming "Error 203 The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)" when visual studio has no problem with the namespace and finds the SecureStoreProvider class inside it just fine.
I've also tried to change the target framework from 3.5 to 4 and only see "Install other frameworks..." in the target framework dropdown.
I'm sure that others have dealt with this, but have been unsuccessful in framing the right google search query. I'm relatively new to SharePoint in general and any help would be appreciated.
thanks,
Mike
I was able to get my solution upgraded from a 2010 project to 2013 using the following. Note that this will update your solution to use the new 2013 API. It is possible to update just the project file but still run in 2010 mode.
First edit your .csproj file (for c#).
Modify the target framework to this:
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
Add this a node for the office version, I put mine directly below the TargetFrameworkVersion tag
<TargetOfficeVersion>15.0</TargetOfficeVersion>
Update references
Reload the project and update your referenced assemblies. If you haven't specified a specific version they should already be referencing the v15 (SharePoint 2013) assemblies.
Do a find replace for 14.0.0.0 to 15.0.0.0. This updates any references on your pages, layouts, and master pages to the v15 assemblies.
Change calls
Change any calls to SPUtility.GetGenericSetupPath() to SPUtility.GetVersionedGenericSetupPath()
Check each file to do a check for any hive references. You'll need to add a /15/ to these. EG: _layouts/ to _layouts/15/
Open the package "folder" in visual studio then update the properties for that package to use version 15.
Clean up
Finally do a compile clean up any missed items. Deploy your solution and make sure to test thoroughly.

Web Reference namespace not seen by Visual Studio 2010 compiler after 2.0 to 3.5 project conversion

I'm getting a build error in Visual Studio that's not making any sense:
The type or namespace name 'MyService' does not exist in the namespace 'My.Project' (are you missing an assembly reference?)
The namespace MyService is defined in a Web Reference. In the Object Browser, I can clearly see that namespace and all of the classes defined in it. There are no compile errors for any of the code in the Web Reference.
The code stopped compiling after I changed the framework target from 2.0 to 3.5. Why could the compiler be choking, and how can I go about fixing this? I already tried updating the web reference, but the problem remains. I even tried commenting out the code in the generated "Reference.cs" and copying the code to another code file in the project, and the namespace was still not seen.
My project is referencing the following:
System 2.0.0.0
System.Data 2.0.0.0
System.EnterpriseServices 2.0.0.0
System.Net 3.5.0.0
System.Web.Services 2.0.0.0
System.Xml 2.0.0.0
Update
It isn't just my web service generated code that is having compile problems; for all of the projects converted to .NET 3.5, I cannot reference their namespaces.
I'm still not sure why this is all happening, but I found a workaround; by adding a using Ns = My.Project.MyService to my code, I was able to reference types in the namespace with Ns.MyType.
This is apparently documented as a bug in Visual Studio:
https://connect.microsoft.com/VisualStudio/feedback/details/570557/targeting-net-framework-3-5-actually-targets-3-0-gac
I utilized the workaround documented in the post by copying System.Web.Extensions.dll from C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5 to C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0. Then I restarted Visual Studio.
That alone didn't fix the problem. I had to redo the project conversion from 2.0 to 3.5 after the assembly was copied. After the new conversion, the code compiled as expected. Doing a diff between the project file pre- and post-workaround didn't reveal any substantial differences, so the build errors must have been due to some internal state of Visual Studio.

How do I navigate to the source for a method in an external reference in Visual Studio 2005?

I have a C# project in VS 2005, with a reference to Foo.dll, a library of C++ .NET code, at c:\Foo\Foo.dll. It shows the reference in the Object Browser properly, but for a given object + method, I can't figure out how to navigate to the source for it inside of Visual Studio.
I've built Foo.dll myself from source on my local machine, and Foo.pdb is in the same location as Foo.dll, at c:\Foo\Foo.dll.pdb. I don't have a project for Foo in the solution I'm working within.
Looking at a stack trace from my C# app, I can see that it knows exactly where the source is on my system - I see a line that looks like:
at mycompany.Foo.SomeClass.SomeMethod() in c:\src\foo\src\SomeClass.cc: line 123
This is the right location for that source file, but I can't figure out at all how to easily have VS open SomeClass.cc. Does Visual Studio require that Foo be setup as a project in my solution in order to easily navigate to the source code?
Thanks!
Can you include the project in the solution and build by 'project reference'?
Is your application loading Foo.dll from the patch c:\Foo\Foo.dll? I'm guessing you actually have a copy of the dll in your application's bin folder. If that's the case, the .pdb file will need to be in the same location. Once you do that you should be able to step in to the code - Visual Studio should prompt for the code location.
One other thought - Under Tools > Options, look at the Debugging section. Under the General sub-section, see if "Enable Just My Code (Managed only)" is checked. If it is, uncheck it and then try to debug.

Resources