MSBuild fails when using the UsingTask element with the AssemblyFile attribute. It cannot find the assembly when importing a task in following manners:
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)ESRI.ArcGIS.Server.SDK.BuildTasks.dll" TaskName="GenerateServerAddInXml" />
The assembly file, however, exists and is in the right path. Fusion log reveals that MSBuild does not bother to search at the specified path and probes only in MSBuild.exe directory and then in GAC where the dll is not present.
LOG: Post-policy reference: ESRI.ArcGIS.Server.SDK.BuildTasks, Version=10.6.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/ESRI.ArcGIS.Server.SDK.BuildTasks.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/ESRI.ArcGIS.Server.SDK.BuildTasks/ESRI.ArcGIS.Server.SDK.BuildTasks.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/ESRI.ArcGIS.Server.SDK.BuildTasks.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/ESRI.ArcGIS.Server.SDK.BuildTasks/ESRI.ArcGIS.Server.SDK.BuildTasks.EXE.
MSDN says that the AssemblyFile attribute is equivalent to the Assembly.LoadFrom method in .NET.
Interestingly, this same mechanism works for another dll just fine. Any ideas where the problem could be?
There is actually a difference among these dlls - the latter is not strongly signed.
Update: I removed the strong signature from the dll (with help of ildasm and ilasm) and it still does not work.
Related
I am trying to debug a .exe file with a .pdb. The project is using SCons, and here is the part where it compiles in sconstruct:
env.Append( CCFLAGS=["/EHsc"])
env.Append( CCFLAGS=["/DEBUG", "/Zi", "/Fdgame.pdb"])
env.Program('game', ['game.cpp', Glob('feather/*.cpp')], LIBS=['SDL2', 'SDL2_image', 'SDL2_ttf', 'SDL2_mixer', 'SDL2main'], LIBPATH='lib/Windows/lib')
So I'm adding the flags that are correct (I think) to generate the .pdb. The pdb shows up in my project directory, in the same location where the .exe is. After looking at its contents, I'm pretty sure that it has the correct information to work (at least, it is not empty). I am setting game.exe as the startup item, then running it from VS 2022. However, after running the .exe, Visual Studio claims that the "Binary was not built with debug information."
Modules tab showing this message under "Symbol Status."
According this page on the Microsoft VS documentation, it says:
The debugger searches for symbol files in the following locations:
The project folder.
The location that is specified inside the DLL or the executable (.exe) file. By default, if you have built a DLL or an .exe file on
your computer, the linker places the full path and filename of the
associated .pdb file in the DLL or .exe file. The debugger checks to
see if the symbol file exists in that location.
The same folder as the DLL or .exe file.
My .pdb should fulfill conditions 1 and 3, so I'm confused as to why it can't be found (if that's the issue). The docs do mention that this applies when you build a project, but I've seen other video tutorials online where they just attach .pdbs to running processes and it still works. Is there anything I'm missing?
Try changing to
env.Append( CCFLAGS=["/EHsc"])
env.Append( CCFLAGS=["/DEBUG", "/Zi"])
env.Program('game',
['game.cpp', Glob('feather/*.cpp')],
LIBS=['SDL2', 'SDL2_image', 'SDL2_ttf', 'SDL2_mixer', 'SDL2main'],
LIBPATH='lib/Windows/lib', PDB="game.pdb")
If that's still not in the correct location then change to
PDB="${TARGET.dir}/game.pdb"
See the manpage for info on the PDB environment variable:
https://scons.org/doc/production/HTML/scons-man.html#cv-PDB
So I am working on an example project that displays video from a network stream.
The project is in C++.
After building the project in release, and trying to run the project on a different computer, I get errors on missing DLL files.
These DLL files are located within the installation location of Visual studio.
one example is msvcp140d.dll.
After copying all the missing files, I get a generic error with no specific file.
So:
Is there a way to tell visual studio to add all relevant files when building the project?
Usually, I place all the assets I need in the project folder, and whenever I run it using the Visual Studio debugger, it runs fine. But when I run the .exe file using the command line, or by just clicking on it, it has problems loading the files. The only way it can load the files is if copy all the resource files in the folder that my .exe application resides in. How could change where Visual Studio looks for the resource files when I run it using the Visual Studio Debugger so that it looks in the folder with the .exe in it, and not the project folder for all configurations (i.e. Debug and Release).
If I understand correctly you would like to move application dependencies into the Debug or Release folder.
You can do it using project property page (right click on the project and select properties). From list on the left side, select build events. There are three options, you can use Post-Build.
Have a look here : Visual Studio Post Build Event - Copy to Relative Directory Location
We've recently converted a large MFC-based suite of projects from Visual Studio 2005/2008 to Visual Studio 2012 (Update 5). Our projects previously used a set of configuration-specific manifest files, embedded as resources, to specify the exact version of the side-by-side (SxS) assemblies to load. As an example, below here is a snippet from one of our old manifest files for the VC90 runtime:
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.1" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
Previously, I could associate the identity above with a folder at C:\Windows\WinSxS. An example would be the folder "x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_e163563597edeada" which contains the correct binaries.
As you can see, the folder name contains all the information necessary to populate the assemblyIdentity node's attributes. Unfortunately, this (outdated) article confirms my findings that Microsoft no longer stores VC2010+ SxS files in this manner. I want to tell our projects to run against the latest Microsoft Visual C++ 2012 Redistributable (installer v11.0.61030.0). How do I locate the correct name/version/publicKeyToken information for these binaries? I could not find an MSDN listing or similar.
Note that I've been using sxstrace.exe / Dependency Walker and the like to investigate this issue. I can confirm the manifest files are being appropriately embedded in our executables; the issue is only the manifest files are specified incorrectly.
Thanks in advance!
Look at this. As I remember correctly by default your application will be linked to libs as in your Windows SDK. And to make project use default libs just delete info about them inside your project file or recreate project with default settings.
I have compiled an exe file in Visual Studio 2013, and it depends on some external files to function. I want to keep those files in the same folder that the exe is in. When I run the .exe by clicking on it in file explorer, it loads the files fine. However, when I run it from Visual Studio, it is unable to run because the PATH variable does not include the directory with the necessary files. How can I configure my project to run the program with a modified path variable so that it can access the files properly?
As far as I understand you question correctly. I suspect that this is an issue related to the different directories when you execute. In Visual Studio (to my knowledge), you have a folder named Debug and a second folder named Release.
You may choose in Visual Studio to run the program in either debug or release mode. But you might not have the required files neccessary in both directories.
For example:
I've made a program that reads "Hello World!" from hello.txt, and displays this in the dialog window as a string.
If I store the file in the Release directory, the executable will run fine outside the IDE, when just launching the executable file.
However, if you run the application in debug mode through the IDE (Visual Studio), the program will not find the neccessary file. The program is looking for the file in it's current directory (Debug).
A quick fix to this is to copy the required files to the current working directory. Eventually have a duplicate set of files in both directories at all times.
Hope that I did understand you correct, and that my answer helps you. :)