How to specify path in .config file relative path to folder? - deployment

I have folder "NuGetPackages". I need to access only the folder on my computer is OK but on server is different folder structure where the project is store
what i use on my computer absolute path:
C:\workspace\HUD\02_Development\04_Tools\NuGetServer\NuGetPackages
What should I write in the config file to make sure the path is ..\NuGetPackages expanded relative to the config file rather the working?
directory?
I can't change the app I can only change the config file.
I have also try "~/NuGetPackages" but didn't work.

In short, you can't do exactly what you're trying to do.
If you can't change any of the code, your only real option is to use config transforms. You can have your *.Debug.config use your local path, and then your *.Release.config (or whatever your published build configuration is), and use the server's path.
Here are some docs on doing config transforms: https://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx

Related

C library can't find it's .cfg file on iOS

I have compiled the labstreaminglayer library for an iOS app, which works fine. But I would like to do some configuration as described here. But I can't get the library to find the lsl_api.cfg file.
Just putting it in any of the folders in XCode doesn't work, even though I can see that is there by searching for it and printing the path. I can set the LSLAPICFG environment variable but again anything I can think to put in there for a relative path doesn't point to the right place and I can't find any other env variable in this list which gives the absolute path...
With the benefit of a nights sleep I realised I can just edit liblsl and add some logging to figure out what is going on. So liblsl tries to look for the config file in the ~ folder, giving the path:
/private/var/mobile/Containers/Data/Application/GUID1/
While the lsl_api.cfg file is copied to:
/private/var/containers/Bundle/Application/GUID2/APPNAME.app/lsl_api.cfg
And libsl can't seem to access files in the GUID2 folder at all, something to do with sandboxing perhaps?
But both liblsl and the App can both access the /Documents folder (perhaps because I enabled iTunes File Sharing?) so I can just chuck the cfg file in there and update libsl to find it. With the added benefit that I can just edit it on my mac.
So I'm still not sure what I would do if I didn't want to put the cfg file in the /Documents folder but at least this works!

Vscode open file with "ctrl-click" with relative paths

I have a .yaml file that has a key value pair, the value being a string with a note saying see <filepath>.yaml
I want to be able to "ctrl-click" on the file to open it, and this works with absolute paths e.g.: See file:///c:/dev/<rest of path>/<file>.yaml
Is this possible with relative paths? How is vscode treating the root folder? Can I set a root folder for file:/// to look for first?

How to copy file from applicationStorageDirectory into dataDirectory?

I would like to copy an image file located in www/assets/imgs/christmas.jpg to the dataDirectory folder using the Ionic Native File Plugin, however I don't know how to access the www folder. I tried the following:
this.file.checkFile(this.file.applicationStorageDirectory, 'assets/imgs/christmas.jpg')
But it always returns NOT_FOUND_ERR.
You should change applicationStorageDirectory to applicationDirectory (although I am not sure what the difference is) and add www in front of the file path as the application directory contains the www folder and not its contents. So instead of assets/imgs/christmas.jpg use www/assets/imgs/christmas.jpg

TDS File Replacement

I want to deploy some front end assets to the local web root of a site using file replacement. I can't seem to get it to work with a relative path in the target location field though. Is it possible to do this though tds or should I use a post build event instead?
The reason these assets aren't included in a project is that they are part of a third party solution but we still want this tracked in source control to try to make the project setup easier.
Most developer machines will be set up the same way for this project with the same file structure but I think it's a little more flexible if I can make the target a relative path so I don't need to worry about differences like drive letters and such.
The folder structure is as follows:
repo
folderToCopy
sitecore
webroot
I have tried the following using ..'s based on what tds changed my source location to be while using the "Make selected Source Location relative" option (changed it from an absolute path to ..\folderToCopy\):
../../Sitecore/Website
/../../Sitecore/Website
..\..\Sitecore\Website
\..\..\Sitecore\Website
From my understanding, TDS does the file replacement based on the files published from the associated Website project.
You can then have relative replacements such as the following:
<Replacement Include=".\assets\folderToCopy\myFile.txt">
<TargetPath>.\assets\targetFolder\myFile.txt</TargetPath>
<IsFolder>False</IsFolder>
<IsRelative>True</IsRelative>
</Replacement>
I have not been able to successfully get TDS to use the file replacement with files that are in source control but not in the project.
My suggestion would be to set up a build event that will copy these files to the correct location, or to create a nuget feed for them and pull them in as nuget references.

Enterprise Library FileConfigurationSource looking in the path of the calling app

"The configuration file C:\mywebapp\mydoamin.dll.config could not be found."
mywebapp domain is the originating code. mydomain is the executing code that references FileConfigurationSource and that is where the config file is located. I'm expecting it to look in mydomain... c:\mydomain\mydomain.dll.config instead. Am I missing something?
If you are using a relative path with FileConfigurationSource it is going to look for the file in the AppDomain.CurrentDomain.BaseDirectory directory. Actually, it will combine the BaseDirectory with the relative path given as the constructor argument to try to locate the file.
You either need to deploy the configuration file into the web root directory (based on your current code) or use an absolute path.