Import XSD targetNameSpace From another Visual Studio project - vb.net

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.

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".

Related

VS2010: How to change automatic generated XML documentation file name

I recently changed my project's dll name from ObjectCreator1.1.dll to ObjectCreator.dll. This project also creates an XML documentation (Properties->Compile->Generate XML Documentation file). Now the problem is that I have renamed my assembly name with all the proper steps, and when I compile my project I get the right .dll and .pdb files, but the file name of this XML file is always ObjectCreator1._1.Template.xml. Is there any way I can rename this file to ObjectCreator.Template.xml?
I tried compiling my project without "Generate XML Documentation file" checked, and I recompiled after that with the "Generate XML doc file" checked... but somehow it is still taking the old assembly name.
Any idea from where it is taking this old name from or how I can rename it? It is a VB.NET project.
For a WinForms project it takes the name from the Assembly Name (specified in My Project under the Application tab).
I just changed the assembly name in my current project and recompiled, and a new XML file with the new name was generated.
For library projects, the name appears to be taken from the Root Namespace field instead.
If it's not working for you, try doing a full solution clean and rebuild.

Reference VB.NET DLL in Kofax Document Validation Script

We are working on a validation script for Kofax Capture 9.0 / 10.0 in VB.NET 3.5.
We know how to create a script using the Admin Module, and how to get it operational.
The problem is that we need to reference a dll, located on a remote machine. (GAC is no option) This dll holds abstract classes we need in each validation script.
Even when putting the dlls locally (copy local), the Validation Module (index.exe) immediately throws the "cannot find reference" exception, even though the project compiled perfectly.
I guess the basic question comes down to: where do we put the dlls, in order for the Validation Module to find them?
The simple answer is to put the dll in the same folder as the application because this is one of the places which .NET will probe when trying to find it. The Validation module is run from the Capture bin directory which will be something like "C:\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin\". This would need to be done on each client using Validation.
If you have a more complicated scenario, you could look implementing the AppDomain.AssemblyResolve Event and using Assembly.LoadFile to get the assembly from a custom location, but the using the bin path is less complicated.
If you end up having further trouble, you can troubleshoot by using the Assembly Binding Log Viewer (Fuslogvw.exe) which can tell you more details about why the assembly failed to load and where .NET tried to search for it. Assembly loading can fail for reasons other than just the path.
For more detail on how .NET loads assemblies, see the following:
How the Runtime Locates Assemblies
Locating the Assembly through Codebases or Probing
We found a solution: add all library files as "links" to the project. (Add --> Existing File --> small arrow next to "Add" --> Add as Link)
This ensures the files are compiled when you build the project. The Kofax Validation Module can now find the files, whereas when referencing the file, it could not. Why it could not, remains a mystery...

Visual Studio 2013 C# Web Project builds but IDE reports The type or namespace name xxx could not be found error

When opening an MVC4 C# web project in Visual Studio 2013, the IDE reports the error "The type or namespace name '_' could not be found (are you missing a using directive or an assembly reference)", but the project builds and runs without any errors. Furthermore, intellisense does not include the project namespace.
The "missing" reference is to files within the same project.
for example; the web project namespace is "webproject.com", and references in a controller files to "webproject.com.models" is underlined in red with the error above.
I have checked the following:
All Solution projects are configured to use the same Target Framework(.Net 4)
web.config in the Views folder contains the namespace in the system.web.webPages.razor section
cleaned and rebuilt solution
deleted all bin and obj content
deleted .suo and .csproj.user files that were created by VS2010
The only way that I can get rid of these errors being reported in VS2013 is to unload then reload the project.
When opened in Visual Studio 2010 I do not get these problems.
I have the same issue.
ALthough the project compiles correctly, the code editor shows an error The type or namespace name '_' could not be found (are you missing a using directive or an assembly reference).
THere is one workaround. Just delete the *.SUO files and re-open the solution. THen for this only Session it works. Unfortunately after closing and reopening the solution the issue is back again. VS 2012 works fine.
Seems to be a bug in VS 2013....
My solution, when I encountered the problem with VS 2013 Express edition was to simply unload the offending project and reload. Opening the SUO or Project file and making changes had not affect.
Try to unload the project in VS2013, then right click the node and select edit "projectname.csproj". Check the individual references they might point to somewhere strange.
EDIT: the csproj file is an xml file and the references are located under Project -> ItemGroup -> Reference
I had the same issue.
It's a VS 2012 solution with different projects.
Search for all *.suo files and deleted them.
Rebuild and reopen Visual Studio.
There's a known issue with Web Application projects when bound to a TFS server that sounds like this issue. This occurs when the following TFS setting option is checked:
Options -> Source Control -> Environment -> Get everything when a solution or project is opened.
Disabling this option resolves the problem.
thanks,
Miguel Lacouture
[MSFT]
Same issue, on project reference.
I opened the referenced project file (*.csproj) with a text editor and did some cleanup:
1) reset these properties' values:
<PublishUrl>publish\</PublishUrl>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
2) removed dirty platform/configurations:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
...
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
...
Now I can compile without any issue.
Glad to share it with you! :))
Same issue. Opening the project's properties and making a change to the name (or any value) and then rebuilding seems to have resolved it.
I have just had this problem and none of the solutions here helped. I fixed mine by doing a repair of Visual Studio (An option when you select to uninstall the program). Hope this helps someone
I had same issue when I added a new class file ( e.g. MyClass.cs) and called it in some other C# code places. For some reason VS did not add that new class file to my working project folder (not seen in VS, but seen in Windows File Explorer). And, hence, the compile path for new class file is not included in the compile section of my project file (e.g. MyProject.csproj). So to solve this problem, First, right click on your working project > Add > Existing Item ... > Select your new class > OK.
Then, check the project file (*.csproj) and make sure a new element is inserted in the compile section such as:
Finally, rebuild your project and the problem should be solved.
Another reason for this issue is the project, I had long ago with VS, is my other project was set up with Client Profile as its target framework. So, to solve the issue: Right click your project in VS > Properties > Application tab > make sure Target Framework option is not Client Profile. You should change all projects in your solution to the same framework version AND all of them must not have Client Profile option.
Microsoft just released a new security update to be automatically applied to machines configured to use Microsoft Update.
Unfortunately, some ASP.NET MVC 3 and 4 VS projects can no longer build after the update is applied. These projects will fail with the following error:
"Could not locate the assembly "System.Web.Mvc,Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL"
My project also had the error "The type or namespace name 'System.Web.Mvc' could not be found (are you missing a using directive or an assembly reference)". Installing the latest version of Microsoft.AspNet.Mvc solved my problem. See the following article from Microsoft for more info:
http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx
Unloading and then reloading the project worked for me.

How to create a dll like shell32.dll which contains Icons

I am working on the Visual studio 2010. want to create a dll which contains icons just like shell32.dll. Can anyone guide me what I need to do.
Purpose : I just want my fav icons bind with one dll and keep in my root drive and customize me all folder icons and I just need it ot contain Dll thats it.
I have not idea what and all efforted is needed, I am ready to put how much effort is needed.
Any suggestion or comment is welcome.
I am not sure what detail is need so adding the picture of shell32.dll.
You can create a Resource-Only DLL.
From the link:
To create a resource-only DLL, you create a new Win32 DLL (non-MFC)
project and add your resources to the project.
Select Win32 Project in the New Project dialog box and specify a DLL project type in the Win32 Project Wizard.
Create a new resource script that contains the resources (such as a string or a menu) for the DLL and save the .rc file.
On the Project menu, click Add Existing Item, and then insert the new .rc file into the project.
Specify the /NOENTRY linker option. /NOENTRY prevents the linker from linking a reference to _main into the DLL; this option is
required to create a resource-only DLL.
Build the DLL.

Deploy SL4 application with localized DLL imports

I have a VS2010 SL4 project which uses an external Silverlight DLL. The project is localized with multiple RESX files, and the DLL is, too. I usually include external DLLs in my solutions as follows:
1) create a set of virtual folders in my solution like (say the imported DLL is named Sample.dll):
/Lib/Sample/Debug
/Lib/Sample/Release
2) create the same folders structure in the file system and copy under Debug and Release the respective versions of the DLL, so that now I find the following files:
/Lib/Sample/Debug/Sample.dll
/Lib/Sample/Release/Sample.dll
3) add to all the client projects in the solution a reference to /Lib/Sample/Debug/Sample.dll.
4) open the .csproj file of each project with the added reference, and change the Debug part of the path with $(Configuration), so that the right Debug/Release version is picked during build.
Now the question is: in my SL4 solution I can follow the same procedure for importing the language-neutral DLL. But what about its satellite resources? For instance, the French version of the imported DLL is built under subfolder fr-FR and named Sample.resources.dll. How should I include it correctly? Even If I try to manually add it in the compiled XAP under folder fr, it is ignored and the application falls back to its neutral culture...
I think I found it, here's a recap for whom may be interested:
open the .csproj file and ensure you add all your desired languages (separated by semicolons) in . For instance, if you support fr-Fr add <SupportedCultures>fr-Fr</SupportedCultures>.
(had to do this manually, I supposed 1. should be enough): once compiled, open your xap (rename it to .zip and open) and add if not present an element like <AssemblyPart Source="fr-FR/Sample.resources.dll" /> for each imported satellite with resources.
Thanks anyway!