referencing a dll in MSbuild - dll

I have an application that I am trying to build through the command line with MSBuild. This project will be built on a machine without a specific dll in the GAC (the dll it will need is in the GAC on the machine on which it is running on). Is there a way that in the MSBuild command that I can have it referrence a dll in a folder? Changing the proj file would require some changes in each of the projects that we use. Is there a way to reference the dll in the MSBuild Command Line?

Related

Files needed to run a standalone exe built with wxWidgets

I have built an EXE with wxWidgets 3.1.4 under Visual Studio 2017.
I can start the EXE from Visual Studio but not outside Visual Studio.
I get the message:
Unhandled unknown exception; terminating the application.
EXE is built in Release/x86.
I have tried to copy the Release DLLs of wxWidgets in the same folder as the EXE as well as files from vc_redist_x86 but I still get the error.
Thanks for your help
It was an application error, a resource file was missing.
I have deleted the Release folder, rebuilt and copied the resource file and the EXE runs.
Release DLLs are in my %PATH% and I have installed vc_redist_x86.exe so I guess these two things allow my standalone EXE to start.
#MaximeVermier,
In order to build the library yourself:
Open ${WXWIN}\build\msw\wx_vcN.sln.
Select Build->Batch Build...
Select all project which says "Debug/Win32"
Click "Build".
The resulting libraries will be in ${WXWIN}\lib directory.
Now all you need is to change the project file for your application and rebuild.
Then you will not need wxWidgets DLLs.

How to use msbuild to generate a VS .sln file where everything is on x64 platform?

When I build my project in command line, everything works fine. But when I tried to generate a .sln file for the project by running msbuild /t:SlnGen /p:Platform=x64
at the command prompt, and then click build in VS (debug, x64), I got an error saying it can't copy a dependent binary folder because it is not found. Since my project is on CBT, I have x64, x86 and Any-CPU platform settings. My project used to be built on CoreXT. My suspicion is VS build doesn't handle the output path of the dependencies correctly.
Then how can I build the solution only on x64 through VS?
Any hint will be very helpful!

Dll not appearing in references for VBA after installing using install shield

I created an install shield project for an Excel add-in.
I selected .dll file and the .tlb file to be moved to the GAC (in destination folder) and program files folder
Those files are present in the program files folder
But when I go to Excel, click on tools-> reference, they are not appearing in that list!
I had to manually browse to the location of that .tlb file and select it
What change should i make so that it automatically comes in the references list
This article gives you description of two methods to do the registration with Installshield: Installshield Register.Net DLLs.
I definitely recommend Approach 2 - Run a .bat file to register the files. This approach runs the RegAsm for the install and uninstall processes using a batch file. This will give you control over the registration process, where you know exactly what is done, and you can handle all bitness scenarios 32/64/Wow64. In Approach 1 you don't, as stated in the article:
For some reason, perhaps that I am installing a 32bit component on a 64bit machine, this didn’t work as expected. [...] some DLL’s perform post registration actions the run when you run RegAsm.exe VirtualCam.dll /nologo /codebase but don’t get captured when you run RegAsm.exe VirtualCam.dll /nologo /codebase /regfile
If possible I would recommend switching to a different installation package creator, that supports run operations and gives better control over the process than using a batch.
*As it's not a native COM dll but a dotNet dll exposed to COM, there's no need for regsvr32 registration.

How can I DllImport a file from resources using VB.NET?

Is there any way in VB.NET to DllImport a dll file from the resources?
I really don't want to add the dll with the executable path.
You can embed a DLL into an executable:
Jeffrey Richter: Excerpt #2 from CLR via C#, Third Edition
Many applications consist of an EXE file that depends on many DLL
files. When deploying this application, all the files must be
deployed. However, there is a technique that you can use to deploy
just a single EXE file. First, identify all the DLL files that your
EXE file depends on that do not ship as part of the Microsoft .NET
Framework itself. Then add these DLLs to your Visual Studio project.
For each DLL file you add, display its properties and change its
“Build Action” to “Embedded Resource.” This causes the C# compiler to
embed the DLL file(s) into your EXE file, and you can deploy this one
EXE file.
At runtime, the CLR won’t be able to find the dependent DLL
assemblies, which is a problem. To fix this, when your application
initializes, register a callback method with the AppDomain’s
ResolveAssembly event.

TFS 2010 MSBuild: After dll in Binaries folder

I'm currently using the AfterBuild target to extend my build script but at that point the dll for the project hasn't been placed in the Binaries folder.
What target will run after the dll has been placed in the Binaries folder?
If you're talking in the context of TeamBuild (you tagged it TFS), here's a relevant MSDN link