Interop dll referencing other dll - dll

I am using bPAC SDK provided by Brother for their label printer. I downloaded their SDK, took a bpac.dll file and put it inside my projects folder then referenced it. Everything works fine until I deploy my app to IIS server because, as it turns out, that bpac.dll is referencing another .dll in C:\Program Files\Common Files\Brother folder and IIS does not have required permissions to access that file. This is VERY strange, and strange is that the bpac.dll in my Visual Studio is marked as Interop, whatever it means. How to solve this? How impot all the .dlls to my project so it doesn't need to access files in system folders?

Related

Deploy 3rd party dll files with VSIX Visual Studio extension

I am developing a Visual Studio Extension. I have used a 3rd party dll for UI controls. It adds 2 dll files as reference. But when I deploy my Visual Studio extension, the dlls does not seem to get copied. How do I deal with this scenario and deploy the dll from 3rd party package along with VSIX installer ?
On investigation, I found out that the dlls are getting copied properly inside "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions" folder, but somehow the extension is unable to load them.
You need to tell VS where to load the assembly.
I have resolved the issue. The problem was that the assembly was not in the list of references and therefore it was not getting loaded. To load the assembly manually, I used AppDomain.CurrentDomain.Load() method

Copy to AppX output directory with Visual Studio 2013 (WinRT app)?

I have a WinRT app built with VS2013 using C#. It uses SQLite so it needs the sqlite3.dll included in the project to be in the output directory. I included that DLL in my project and set it to always copy to the output directory. The problem is VS2013 copies it to the Debug directory, but not the AppX directory underneath Debug, which appears to be the WinRT output directory. Because of the the app fails because it can't find sqlite3.dll, which is up in the parent Debug directory instead of the AppX directory.
For now I'm just hand-copying the DLL into the AppX directory. What's the best way to fix this problem so that the DLL is copied to the correct directory?
In your project's Properties window choose Build Events tab. On Post-build window include similar string (please, mind to change the path to sqlite3.dll):
xcopy /Y $(ProjectDir)3DParties\sqlite3\$(PlatformName)\sqlite3.dll $(TargetDir)AppX\
Or even better option. This page https://www.sqlite.org/download.html contains section named "Precompiled Binaries for Windows Runtime" where you can download VSIX package. When you install this package into your system, you can simply reference sqlite3.dll for all target platforms (ARM, x86, x64) including all necessities automatically like this: Add Reference -> Windows 8.1 -> Extensions -> SQLite for Windows Runtime (Windows 8.1)
I can't be sure this is the "right" solution, but I set the file's property to Content/Copy-if-newer.
THEN what I've found is that if the AppX directory is already there, VS doesn't update it, just as you describe above, BUT if you delete the Appx directory then VS will create it from scratch and add the necessary files.
Not as good as having everything automated, but beats hand-copying.

how to get executable files of vb.net and access database?

I have successfully program a VB.NET 2010 program connected with access database.
I wanna to know how can I run my program on another PC haven't visual studio on it?
what I must copy and how many file are them? and what the extensions of the files? and how can I get these files?
You can create an installation/setup project which will copy and install all the relevant files.
Read this tutorial for more details.
When a source code is run through visual studio, an executable file is created in the directory of the project. The directory is in the project file \bin\debug. You could also find the database there if connected.
The program that you are looking for is usually in the extension .exe. You also need to make sure that the database is always in the same directory as the .exe file if you will run it on a different computer without visual studio or any other compiler just that the machine is compatible with .exe files (eg. windows OS on machine)

VB.net app without installation

Is it possible to create a VB.Net application which users can just run without installing it first.
If not, is it possible in another .Net language.
If not, how IS it possible :)
PS: The application only has to run under Windows (>= XP).
If they have the .NET Framework installed (the version of it that you developed it), they only need the .exe. You can find the .exe file in the bin directory of your projects folder in your Visual Studio workspace.
If they do not have the framework installed, you'll need to produce an installation for them. It's extremely easy with Visual Studio by just creating a setup project in the same solution as your code.
As long as the user has the .net runtime installed, and your exe has any needed resources in the same folder (dll's, images, ect) theres no problem with that.
If you mean without installing the .net framework though, that won't be possible.
just build the program, and go into the (assuming the project name is app1) app1/app1/bin/debug/ dir. there should be a file there called app1.exe. this file is the compiled .exe from you project. any other computer will be able to run this without doing any installation (provided they have the .NET framework installed (it comes standard on any computer with an os > WinXP))
EDIT: If you were building with debug configuration, it would be app1/app1/bin/debug/, but if you were building with release configuration (which would probably be a better idea if you are distributing) the path would be app1/app1/bin/release/
If you mean running it without the .NET Framework, it used to be possible, but apparently the company's website is no longer in English so I have no idea what's happened to it.
EDIT: If you were building with debug configuration, it would be
app1/app1/bin/debug/, but if you were building with release
configuration (which would probably be a better idea if you are
distributing) the path would be app1/app1/bin/release/
I am developer and have no administration rights to live(production) network.
I had to find away to deploy an app without installation... and my app is self updating this cause other problems too....
The production network Computer check/monitors the file versions etc, so updating in the program files can not be done, where a MSI has been used for deployment.
Using this above I am able to copy and Run the App from the User Profile (where the user has full rights).
lets understand how program runs-
an .exe needs some function which are not inside the .exe, such as , for example substring() function. these predefined function resides in some .dll libraries.
when .exe is executed by user, .exe first finds the .dll and then the function inside that particular .dll.
.exe first looks within the current folder for that .dll
if not found then it searches that in PATHs. (PATH is Environment variable which value is a list of folders such as System32 etc.)
an .exe usually needs only 3 things - .exe itself, .dll which predefined function it is using, and some ActiveX controls(.ocx). apart from these 3, .exe only uses resources (such as icons etc).
lets focus on these 3(.exe, .dll, .ocx)
first you need to check what .dlls your .exe is using. you can easiely do this by using a dependency walker.
then make sure all these .dlls (that dependency walker is showing,or in other words- all these dlls whose functions your .exe needs) are either in current folder(in which your .exe resides) or in the PATHs.
if this step is done then your .exe has high chances to run whithout "installing".
the only problem is that some .dll and all of .ocx, needs to be registered first(means they have to have some kind of registry entry). they are not ready to use just by copying and pasting in current folder or PATHs.
but you can register these .dlls and .ocx's by using regsvr32 (with command line).
after that your .exe should not face any problem to run successfully.
hope you got the main concept.

vb.net adding a reference

i added itextsharp.dll to my project. it is on my desktop. everything compiles and works fine. if i install my application on another computer it is looking for the same file itextsharp.dll on the users desktop.
how do i make it so that the DLL is built in to the project??
What's with the Desktop now?!
Bundle all your deployable assemblies in the same output folder as your application's main assembly.
While creating the Setup...I am assuming your using MS project setup..make sure all the deployables point to a common folder target.
I don't understand your fixation with Desktop...pls let me know if that is some sort of requirement.
The only thing that is usually deployed onto Desktop is the App's Shortcut.
Make sure that when you add the DLL to your project, you set 'Copy Local' to true. That way, the DLL will get copied to the 'bin' folder of your application rather than the original location of the DLL.