i have following code and when i pass absolute path my project works but i need relative path configuration.ini is a file which is in my current project so when i give absolute path, like this ,the code never runs
<app Settings
<add key="Configuration Path" value="d:DocsWcfService\Configuration.INI"/>
</app Settings
i need something like this ,is there any way?
<app Settings
<add key="Configuration Path" value="~\Configuration.INI"/>
</app Settings
Server.MapPath
var physicalPath = Server.MapPath("~\Configuration.ini");
I had the same problem for config file before. I was able to use full path and it was working fine. When I try to use relative path , it wasn't able to find my config file. I hope my solution helps you or at least give you an idea.
Try to click file located in the solution expllorer and expand the properties tab to change 'copy to output directory' as 'Copy Always' . As I know VS copy to file to \bin\Debug folder every time when we run the project, so the relative path of that file will always be the same during development as well as after deployment.
After that below code will be enough
<app Settings
<add key="Configuration Path" value="Configuration.INI"/>
</app Settings
Related
I have a Nightwatch + BrowserStack configuration on my project and I'm trying to add custom commands to my project to compare 2 screenshots using resemble.js .
I configure my nightwatch.json file with this :
"custom_commands_path": "./node_modules/nightwatch/commands",
"custom_assertions_path": "./node_modules/nightwatch/assertions"
I put the commands file in the folder and I tried to run my test in every directory possible to see if it was a path problem. I've also tried with different commands, some of them I get online and even the default example one. Whatever I run it returns nameOfTheCommand is not a function. So I guess it does not even find the path to the customs commands in the nightwatch.json file.
Is there anything I'm missing here? I'm quite new so the answer could be very simple but I tried every .json file of my project in case there was a special configuration linked to BrowserStack.
Path to the custom commands should be analogous to the path to custom commands. You should point a folder where you added them.
I've found that if I put them in the suite configuration file, it picks them up:
nightwatch_config = {
src_folders: ["tests/suite/product/"],
page_objects_path: "pages/product",
custom_commands_path: "./custom_commands"
}
I'm trying to import someone else's Flex project folder into Flash Builder 4.5, and I'm having some problems with the paths. When I load everything up, I'm getting errors that say that the "Type was not found or was not a compile-time constant" for all the .as files living in src. It looks like based on the path settings, it cannot find those files.
So I went to the Package > Properties and tried to add the src folder to the Source Path list, but no luck there either.
One curious thing is that when I look at the error at the bottom, I see Path is set to /ProjectName/src/. Is that an absolute path? Certainly it wouldn't find them if it were.
Can anyone shed some light on getting my Flex project to find my src folder?
Thanks,
Whit
/ProjectName/foo/bar in Flash Builder would be resolved to the project's foo/bar directory, therefore it is not an absolute path.
The project you experience may also have to do with the libraries (SWCs) referenced by your project are not properly referenced. You may go to Project -> Properties -> Flex Build Path -> Library path (tab) and add reference to libraries similar to the fashion you add the Source Path.
Additionally, when source path is correctly added, you would also notice a "virtual folder" appearing in the referencing project, which allows you to directly load and edit the source code of the referenced project.
I want to integrate Unity in my app and I want it to use an external config file
The Unity initialization code is
var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = "unity.config" };
System.Configuration.Configuration configuration =
ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
// *** problem starts here ***
var unitySection = (UnityConfigurationSection)configuration.GetSection("unity");
var container = new UnityContainer().LoadConfiguration(unitySection);
Also I have external config file for unity, named "unity.config" with the following content
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IEmailConfigurator" type="Server.Common.Interfaces.IEmailConfigurator, Server.Common" />
<alias alias="EmailConfigurator" type="Server.Common.EmailConfigurator, Server.Common" />
<namespace name="Server.Common.Interfaces" />
<namespace name="Server.Common" />
<container>
<register type="IEmailConfigurator" mapTo="EmailConfigurator" />
</container>
</unity>
The problem is, in the line where I want to load unitySection, GetSection() returns null.
What could be the problem?
EDIT
I added
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
However, now when I trace through code, in line
System.Configuration.Configuration configuration = //...
The configuration variable in initialized that FilePath property is C:\Program Files (x86)\IIS Express\unity.config, and not my own unity.config file
Any idea how to reference the config file from web folder?
Thank you.
http://msdn.microsoft.com/en-us/library/ff660935%28v=pandp.20%29.aspx
Your external config file must also start from <configuration> tag, not <unity> tag
Did you try to add the <configuration> and <configSections> element to your config file?
I don't know if you solved this yet. In Visual Studio, you have to ensure the following file properties for "Unity.config":
Build Action -> "Content"
Copy to Output Directory -> "Copy if newer" or "Copy Always"
I suggest "Copy Always" to ensure the current Unity configuration is always present after a build.
To access the web folder, use the HttpServerUtility.MapPath method.
var mappedConfig = Server.MapPath("~/unity.config");
Server is a property of the Page, or use HttpContext.Current.Server.
I am using Hudson tool to automate tests for our project. I want to use FSTrigger plugin to trigger the build whenever there will a change in SVN.
As i set Folder path to "http://192.16.17.121/test/test1/config/". It gives error that folder should exist, but it exists at specified location.I can view it directly from browser too.
Can anybody tell me whats the problem?Your help will be appreciated.
Thanks...
You have to specify an absolute path to a directory on your filesystem. What you have shown there is a URL.
An absolute path would look like this:
/var/www/html/test/test1/config
I'm using FitNesse as a functional testing framework. I'm running into trouble when FitNesse runs code that needs configuration.
If I need to get a connection string from the configuration file, I can get it to work by adding it to the FitServer.exe.config. However, I don't like that solution. I would like FitNesse to load my own configuration file, namely TheNameOfMyApp.dll.config.
Is this possible?
Sure, easy to do. I'm assuming you're using the dotnet or dotnet2 test runner. I'm using the dotnet2 test runner, and here's how I've got it set up:
First, when you !define your COMMAND_PATTERN, include -c suite.config. For instance, I have the following in root:
!define COMMAND_PATTERN {%m -c suite.config %p}
!define TEST_RUNNER {..\..\bin\Debug\FitServer.exe}
suite.config goes in the same dir as fitnesse.jar:
<suiteConfig>
<fit.Settings>
<appConfigFile>..\..\MyProjectFolder\fitnesse\MyProjectName.config</appConfigFile>
</fit.Settings>
<fit.Assemblies>
</fit.Assemblies>
<fit.FileExclusions>
<add>^\.svn$</add>
</fit.FileExclusions>
<fit.Namespaces>
</fit.Namespaces>
<fit.CellHandlers>
</fit.CellHandlers>
<fitlibrary.CellHandlers>
</fitlibrary.CellHandlers>
</suiteConfig>
MyProjectName.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="keyname" value="something" />
</appSettings>
</configuration>
You can make things easier for yourself if you use an absolute path for the appConfigFile. I started off with an absolute path, got things working, then switched to a relative path by trial and error.
Note that I'm running my test runner from a non-standard location, which will affect the relative path in suite.config. The path is relative to your TEST_RUNNER location, NOT to suite.config or fitnesse.jar.
yes it is possible but an awful load of work. you need to define a test-project where you have your tests in it and a "wrapper"-project where you have the functionality of providing the tests with data and configuration settings.