How can I reference FakeLib.dll in a Fake.Deploy deployment script? - f#

I'm trying to reference FakeLib.dll from my local Fake.Deploy installation in my deployment script but can't seem to find the correct path to use. I found that Environment.CurrentDirectory points to my Fake.Deploy installation, but just using
#r #"FakeLib.dll"
doesn't work:
Deploy messages
{
2015-05-12 09::22:50.413
2015-05-12 09::22:50.417
2015-05-12 09::22:50.417 Install.fsx(2,1): error FS0082: Could not resolve this reference. Could not locate the assembly "FakeLib.dll". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. (Code=MSB3245)
2015-05-12 09::22:50.432
2015-05-12 09::22:50.432
2015-05-12 09::22:50.433 Install.fsx(2,1): error FS0084: Assembly reference 'FakeLib.dll' was not found or is invalid
}
Examples I found on the web suggest to deploy FAKE along with my application in the NuGet package and reference it like this:
#r #"tools\FAKE\tools\FakeLib.dll"
but this seems like overkill and an unnecessary reference.
Does anyone know what path to use to reference the local Fake.Deploy installation?

Just found the answer myself: the base directory used for references in the post-deployment fsx script is __SOURCE_DIRECTORY__, the directory of the deployment itself.
So assuming your Fake.Deploy is installed in
.\Fake.Deploy\
then Environment.CurrentDirectory will point to this directory, whereas __SOURCE_DIRECTORY__ will point to
.\Fake.Deploy\deployments\\{your_app}\active
So you can reference FakeLib.dll from your post-deployment fsx script as follows:
#r #"..\..\..\FakeLib.dll"
I will try to get this added to the documentation page.
That being said, there are in fact points to be made for deploying FAKE together with your application:
It makes sure the correct version is used to run your deployment script
The Fake.Deploy installation might not be be under your control, so you could be prevented permission-wise from accessing its binaries
The configuration of Fake.Deploy allows to specify a different deplyoment location (via "WorkDirectory"), so this hardcoded path will break when using a non-default location

Note that when your NuGet package is sent over via Fake.Deploy, the agent runs the script in the root of the package from the same folder as the fake executable. So, when your fake.exe is in C:\Fake\tools\fake.exe, your files are in C:\Fake\tools\deployments\YourApplication\active. If you need to read a properties file or something from that directory, your script won't see it. So, you'll need to do the following in your script:
open System
open System.IO
let arguments = System.Environment.GetCommandLineArgs()
let script = arguments.[1]
let scriptDirectory = script.Replace(#"\NameOfMyDeployScript.fsx", #"")
System.IO.Directory.SetCurrentDirectory(scriptDirectory)
I wanted to put that out there so no one loses their mind over trying to access some file. You'll see an error like this if you don't change directories:
System.IO.FileNotFoundException: Could not find file 'C:\Fake\tools\myfile.properties'

Related

Could not locate zlibwapi.dll. Please make sure it is in your library path

I am working on a object detection project and wanting to process the project with my GPU. I have completed the NVIDIA setup tutorial and everything works fine. My object detection code originally works with the CPU, however when I add these two lines of code:
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
the output displayed:
Could not locate zlibwapi.dll. Please make sure it is in your library path!
I have downloaded the zlibwapi.dll zip file stated from the cuDNN website, unzip and added the whole folder into my environment variables paths. The folder is called "zlib123dllx64" containing a "dll_x64" folder and a "static_x64" folder. The "zlibwapi.dll" is inside the "dll_x64" folder. I have added the "zlib123dllx64" folder in the user and system path variable but it doesn't seem to fix any of the problems. How can I fix this error and make the GPU work with the code?
My environment setup:
Windows 10
Visual studio community 2019
OpenCV Python yolov3
Windows Environment:
I faced this issue of "Could not locate zlibwapi.dll. Please make sure it is in your library path" when I am trying to run a TensorRT sample, int8_caffe_mnist. To confirm proper installation of TensorRT.
Following the instructions from: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#prerequisites-windows
Under 3.1.3 download zlib and add the path to the environment variables.
I did the following:
Windows search for Edit the system environment variables
Add library path, Environment Variables -> Path -> Edit -> C:path to\zlibwapi.dll
Conclusion:
Following the instructions for adding zlibwapi.dll to the path did not work for me.
Solution that worked for me:
Removed the library path under Environment variables
copied zlibwapi.dll to C:\Windows\System32 and C:\Windows\SysWOW64
Either delete/keep zlib123dllx64 file, I choose to delete as it does not need the location to library path
I was able to find a copy of the missing zlib DLL in the NVIDIA Nsight directory:
C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\host-windows-x64\zlib.dll
I copied and renamed it to:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\zlibwapi.dll
since that was already in my PATH environment variable. Doing that resolved my error.
I saw the link in the CUDNN documentation that was linked in the other answers, but I was a little concerned by the security warnings.
Stumbled across this problem too and there is an easy fix that immediately worked for me:
Check out Nvidia's page (exact link where to download) and download.
Extract the files and simply find the single file "zlibwapi.dll". Copy this file to
C:/path to/NVIDIA GPU Computing Toolkit / CUDA/ v11.X / bin -> right here in that folder
Just did those two steps and it's TF can properly use GPU.
Download and extract the zlib package from http://www.winimage.com/zLibDll/zlib123dllx64.zip for 64 bit windows then copy the zlibdll file into cudnn/bin
If anyone also got the same problem as me, I managed to fix the problem. Instead of calling the whole "zlib123dllx64" folder into the system environment path, you simply just add the "zlibwapi.dll" inside the "dllx64" folder into your project folder and include it in your project. This fixed my problem. cheers
Didn't find zlibwapi.dll in bin but solved it anyhow.
Since I didn't have it in
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\
I couldn't change environment variable but I found it elsewhere.
mhartlove suggested here:
https://forums.developer.nvidia.com/t/could-not-load-library-cudnn-cnn-infer64-8-dll-error-code-193/218437/17
Solution:
"I found a copy of the 64 bit zlibwapi.dll hiding under a different name in:
C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\host-windows-x64\zlib.dll
I copied and renamed it to:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\zlibwapi.dll
since that folder is already in my PATH variable; and it worked. Turns out the CUDA Toolkit already has the file you need elsewhere. Seems like they could save a lot of trouble if they just made a change to the CUDA Toolkit installer.
"
I downloaded the dll file from https://www.dllme.com/getfile.php?file=38308&id=9b45296e316cdf31b9bace739e22ca7a
Extracted it
see here
renamed
zlibwapi_x64.dll -> zlibwapi.dll
and pasted it in the bin of my CUDA
Look at the last file
This worked for me....

How can I unblacklist 'libnvomx.so', in order to resolve "no such element factory 'omxh264enc'!"?

(Background: In a docker container on a NVidia Jetson TX2 board I have decompressed NVidia's Linux For Tegra tarball which contains lots of drivers and shared object files, some of which provide GStreamer element factories which produce elements that I use in my GStreamer pipeline. I am trying to run the pipeline in the docker container.)
However, there is an element in my GStreamer pipeline (on this Tegra board), called 'omxh264enc', which I haven't been able to create.
I've put the corresponding 'libnvomx.so' in my drivers folder which is in the exported paths GST_PLUGIN_PATH and the LD_LIBRARY_PATH.
ldd -r does not show any missing libraries for libnvomx.so
HOWEVER when I try and run the pipeline, output includes
WARN omx gstomx.c:2826:plugin_init: Failed to load configuration file: Valid key file could not be found in search dirs (searched in: /root/.config:/etc/xdg as per GST_OMX_CONFIG_DIR environment variable, the xdg user config directory (or XDG_CONFIG_HOME) and the system config directory (or XDG_CONFIG_DIRS)
INFO omx gstomx.c:2831:plugin_init: Using default configuration
ERROR omx gstomx.c:2894:plugin_init: Core '/usr/lib/aarch64-linux-gnu/tegra/libnvomx.so' does not exist for element 'omxh264enc'
WARN GST_PLUGIN_LOADING gstplugin.c:526:gst_plugin_register_func: plugin "/gst_1.8.3/libs/gstreamer-1.0/libnvomx.so" failed to initialise
and when I use GST_DEBUG=3 gst-inspect-1.0 libnvomx.so, libnvomx.so is blacklisted.
Plugin Details:
Name libnvomx.so
Description Plugin for blacklisted file
Filename /gst_1.8.3/libs/gstreamer-1.0/libnvomx.so
Version 0.0.0
License BLACKLIST
Source module BLACKLIST
Binary package BLACKLIST
Origin URL BLACKLIST
I have copied libnvomx.so into /usr/lib/aarch64-linux-gnu/tegra but this did not make a difference (probably because libnvomx is blacklisted).
I don't know where to find the gstomx.conf file, where maybe I can change the path /usr/lib/aarch64-linux-gnu/tegra/libnvomx.so to my designated drivers folder (/gst_1.8.3/libs/gstreamer-1.0/). I have used 'find' on /etc and some other folders but didn't find it (I didn't actually find a .config folder on the system).
(There are also other plugins with missing symbols, nvidia_drv.so with undefined symbol TimerSet and libglx.so with undefined symbol serverClient. I would like to find out what is suppose to provide these symbols? But these are not (direct) dependencies of libnvomx.so)
So how can I initialise / unblacklist libnvomx.so so I can use 'omxh264enc'? Do I need to find / make a gstomx configuration file or can I make it work with the default configuration? I read somewhere there may be a solution using a 'symlink' but at the moment I'm not familiar with what these are or how these work.
Let me know if you need more info, thanks.

Can't debug in Edge using Aurelia CLI build

I'm using ASP.NET Core with an Aurelia CLI build (TypeScript, SASS).
I've noticed that I can't debug my TypeScript files in Edge at all - the browser says it is unable to find the source maps, even though the locations are correct and the source maps exist. I can't see any of my src files in the source file browser.
There is no issue with Chrome or Firefox, they just work.
I tested a vanilla HTML / TypeScript project which is fine in Edge for debugging, so it must be something to do with the way the files are packaged in the Aurelia build system.
The specific error I get is along the lines of:
"Could not locate file:///XXXX specified in source map http://localhost:16377/scripts/app-bundle.js.map"
Is this a known issue? Is there any fix for it?
This is definitely an issue with the CLI and how it is producing sourcemaps. It looks like HTML files are having their path in the sourcemap file written as the full drive path on the machine, while the content of the file actually isn't being written out at all.
I've created an issue on our CLI repo: https://github.com/aurelia/cli/issues/409

Github -> Azure Deployment: Cant find path

I am trying to deploy a .NET-MVC-application to Azure via Github, but deployment fails with the following error message. What could be the reason for that? It works locally.
WebCompiler: Begin compiling compilerconfig.json
D:\home\site\repository\src\BeYourMarket.Web\Themes\Default\Content\theme.less : WebCompiler error 0: The system cannot find the path specified. [D:\home\site\repository\src\BeYourMarket.Web\BeYourMarket.Web.csproj]
D:\home\site\repository\src\BeYourMarket.Web\Themes\Default\Content\theme.less : WebCompiler error 0: [D:\home\site\repository\src\BeYourMarket.Web\BeYourMarket.Web.csproj]
WebCompiler: Done compiling compilerconfig.json
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\src\BeYourMarket.Web\BeYourMarket.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d34cc45ff19d01";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository\src\\"
An error has occurred during web site deployment
Thank you in advance for any tipps and hints!
This is a current open issue with WebCompiler project. The Azure file system is locked down in ways that your local environment are not. Even though the file exists at the path on the server, the deployment script cannot read it.
In scanning the comments on the Issue (https://github.com/madskristensen/WebCompiler/issues/146), there doesn't seem to be a solution at this time except to pre-compile your CSS and include it in your repository.
In the end I dealt with it the following way:
Install package LessMsbuildTasks
Remove the file (in my case theme.less) from webcompile (right click on that file: Web Compiler - Remove file)
Add Dotless as build action for that file (right click on that file: Properties - Build action)
Commit changes and push
The next two steps are optional:
Put compilerconfig.json on .gitignore
Add that file to Web compiler again (right click on that file: Web Compiler - Compile file)
That way I can still use the constant compiling to develop and push it to my repository to initiate CI on Azure.

MSBuild cant find resgen.exe

I have a VM machine where I copied over the SDK files and path, went to the registry and added the keys to the registry, but I keep getting the error that resgen.exe cannot be found:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1835,9):
error MSB3091: Task failed because "resgen.exe" was not found, or the correct
Microsoft Windows SDK is not installed. The task is looking for "resgen.exe"
in the"bin" subdirectory beneath the location specified in the Installation Folder
value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\
Windows\v7.0A. You may be able to solve the problem by doing one of the following:
1) Install the Microsoft Windows SDK.
2) Install Visual Studio 2010.
3) Manually set the above registry key to the correct location.
4) Pass the correct location into the "ToolPath" parameter of the task.
I looked in the folder Microsoft\Microsoft SDKs\Windows\v7.0A and copied over the resgen.exe in practically every single net folder including the bin, but it keeps telling me that resgen.exe cannot be found. I have no clue what to do.
Make sure your environment variable path includes the folder in which ResGen.exe resides
Run Regedit to edit your registry. Look for the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows. If there is not already a Setting called "CurrentVersion", create a new registry setting "CurrentVersion" of type REG_SZ. Make sure it has the same value as the setting ProductionVersion in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A.
Make sure, you have the keys HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFX40Tools, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFX40Tools-x86 and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFX40Tools-x64 present in your registry and the value InstallationFolder set in each of them.
I added the following SdkToolPath parameter to the project and that helped. Of course it is not a full solution as it will not work on the buildserver, but for now it works and I just don't check it in from my machine and it means I can do what I need to:
<GenerateResource SdkToolsPath="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools" Sources="#(TextResource)" OutputResources="#(TextResource->'$(OutDir)CommandStrings.resources')" />

Resources