1

I have a VB solution with many VB projects in it. One of them, the "Core" project, has a .xsd file in it with a targetNameSpace of urn:CustomNamespace.

In the Core project, I am able to import the xsd namespace by doing the following:

Imports <xmlns="urn:CustomNamespace"/>

How can I get this Imports statement to work in a project that references the Core project? In the Core, the xsd's namespace shows up with Intellisense. This is not the case in the referring project.

I know this can be done somehow, as we are consuming a nuget package that has an xsd that we are importing.

******** UPDATE ********

It looks like the namespace Intellisense from the DLL in the nuget package is coming from a Configuration Section Designer xsd file, which is a .csd.xsd file. There are other related files to this, but I essentially want the same functionality that comes with referencing a package that has a .csd.xsd file.

It looks this is a VS add in located at https://csd.codeplex.com/. I'll likely pull down the project to try to find out how they're doing it, but I'd appreciate an answer if someone knows how it's done.

ps2goat
  • 8,067
  • 1
  • 35
  • 68

1 Answers1

1

Nuget is likely adding the schema file to the project referencing your "Core" project. You can reference the same xsd file by adding it as a link to the referring project.

Right-click the (non-core) project, select Add>Existing item. Browse to the xsd file - and this bit is key - instead of clicking 'Add', click the little arrow next to "Add" and select "Add as link".

ps2goat
  • 8,067
  • 1
  • 35
  • 68
SSS
  • 4,807
  • 1
  • 23
  • 44
  • I don't want to do that if there's a way to import the xsd namespace without importing the xsd. E.g., I can import `Core.Namespace` without having to do anything more than reference the project. Is this how nuget packages achieve this? – ps2goat Jul 24 '15 at 05:57
  • Hmm. Try deleting the "Root namespace" in the project properties tab of the core module (if there is one). Then add a reference and try importing the namespace. You can try starting with `Global.` or use the Object Browser in the IDE (`F2` key) – SSS Jul 27 '15 at 01:48
  • It appears that you were correct, that I would need to link to the file in order to import the namespace from the xsd. I updated your answer to reflect my situation-- the nuget package did in fact add the xsd directly to the project, which is why I was able to import that namespace. I added a bounty, then found the file in my project-- I'll give you the bounty as soon as my waiting period is over. – ps2goat Aug 05 '15 at 22:42
  • Glad I could help. Thanks for the bounty. Happy programming! :-) – SSS Aug 11 '15 at 02:08