Configure the default search-directory for APK-files - xamarin

I use the recommendation from MS to define a relative path to the APK for a UI Test. But upon running the Test, VisualStudio looks somewhere in my C: drive in Users instead of the solution folder for the APK. How can I explain VS to search within its solution dir and not within the users\appdata???
With an absolut path it work fine but I dont want to use absolut path in a project with many collaborators
The Code:
IApp app = ConfigureApp.Android.ApkFile("../../../_Test/App1/App1.Android/bin/Debug/com.companyname.app1.apk").StartApp();
The Error-Messsage:
ApkFile does not exist: C:\Users\Michael\AppData\Local\_Test\App1\App1.Android\bin\Debug\com.companyname.app1.apk

Related

Visual Studio / Properties / Debug / Working Directory want it permanent but don't want to check in the *.user file

The project setting Debugging / Working Directory in Visual Studio 20015 will be saved by default in the *.user file wich I don't check in in to my repo because it's user specific. Still, I would like to have something other than $(ProjectDir) standing there when I do a clean checkout of my project. Is there an other place to store the Working Directory besides the *.user file?
Edit 1: The original idea is that I have a solution with multiple projects and all the binaries (dlls and exes) created end up in a folder called bin. If I want to debug it, I don't want to always edit the working directory again after a clean checkout.
Edit 2: In a post build step of every project within my solution, I copy the binaries in to the bin folder. If I start one of the executables from within VS, it starts them from the $(ProjectDir) folder, and of course not from the bin folder. This is why it does not find the dlls and why I want to set the working directory. I could change the output directory of my projects but then I get a lot of files ending up in the bin folder I don't want there. I will try it anyway; maybe I missed something. To be continued...
Edit 3: As expected, if I change the output directory to the bin folder, everything works fine except for some extra files that end up there and I don't want that (e.g. *.pbo, which would be okay, *.iobj, *.ipdb, etc.) Maybe that is the price I have to pay, but I don't like it.
So, the question remains: How can I have more control over which file ends up where after a build and still be able to run it from VS without changing the working dir?
The working directory should not have to be the directory that contains your DLLs. In fact, you definitely don't want that to be a requirement for running your application. Not only is it a hugely unexpected failure mode, but it could also be a potential security risk.
Put the required DLLs in the same directory as your application's executable. That's the first place that the loader will look. If necessary, use a post-build event in your library projects to copy them there.
Well since no body can help me I decided that I will change the output directory to the bin folder so VS will start my applications from the correct folder.
And how I can get rid of all the extra files that don't belong there I will find a way later.

Generalize Include Path

I am using Microsoft Visual Studios 2010, and I have found out how to set new include paths. Now I want to make it so that other users can utilize my project. If my current path is C:\Users\jsestrad\Documents\Homework\EE350\Lab\power, for example, is there a way I can start making it search from ..\Homework\EE350\Lab\power so that other users can utilize the include path?
You can use MSBuild properties in the path, including $(ProjectDir), which is the directory in which the project is located, and $(SolutionDir), which is the directory in which the solution is located.
The simplest thing to do would be to ensure that everyone has the include files in the same location relative to the project, then set the include path relative to $(ProjectDir).
For example, if your project is in C:\Users\jsestrad\Documents\Homework\EE350\Lab and your includes are in C:\Users\jsestrad\Documents\Homework\Stuff, you could add $(ProjectDir)..\Stuff to your include path.

How to get the TFS workspace directory

I am trying to access the TFS workspace directory on my local workstation in my csproj file. I have the StyleCop files in source control and I need to add the absolute path. I created an environment variable and the does the job. I was just wondering if it was possible to get the path so my other team members would not have to do any manual configuration.
As you can have many Workspaces locally, the first thing would be to identify which workspace do you want to get the path from.
After that, using the TFS API you can easily get the local path from the server path of your csproj file.
Building a tool that create/update a sysvar can be easily written, I don't know though if it suits you.
Here's the method you should call on the MSDN: http://msdn.microsoft.com/en-us/library/bb139272.aspx

TFS 2010 Build Automation for a Web Site: Delete a file in the publish folder after build

We are trying to adapt a build automation strategy for our ASP.NET web site (not a web project) in vs 2010 ultimate & tfs 2010.
Build definition makes the build and publishes the web site into folders like
<drop_folder>\<defn_name>\<defn_name>_<year><month><day>.<build no>\Release_PublishedWebsites
Now we try to delete particular files and folders from that folder. For instance the "images" or "files" folders, that we need to exclude before packaging. I know that if it were a web project, there exists a straightforward solution. We also tried to modify the build process template (xaml) file. There is a "DeleteDirectory" component but we couldn't figure out what to write to the Directory variable.
Thank you.
If you follow the XAML way, you would just have to feed the Directory argument of DeleteDirectory with the physical UNC path to the folder you 're trying to get rid of.Something along the lines of String.Format("{0}\\{1}\\{2}\\Release_PublishedWebsites", BuildDetail.DropLocation, BuildDetail.BuildNumber, Date.Now.Year)
should get you near to your target. Since the drop location of the build might be on a different machine, also ensure that the account conducting the build (by default = NetworkService) has the rights to delete folders on the target.

How to use environment variables within Visual Studio 2008 project properties?

For example, is it possible to set the Output path to your app folder within Program Files?
%ProgramFiles%\MyCompany\MyApp\ does not work.
quoted by Microsoft here:
Unfortunately this is by design. We do
not support using environment
variables in the UI however you can
edit the file manually in notepad and
specify variable names as you were
trying $(varname). This workaround
will not enable you to make edits to
the property in the project properties
however.
so changing the OutputPath property in your project file to:
<OutputPath>$(ProgramFiles)\MyCompany\MyApp\</OutputPath>
will work but all it does (as you can see when you open the project again in Visual Studio and look at the project properties) is include the relative path from your solution dir to the output dir.
in visual basic 2005
the application folder is defined as my.Application.Info.DirectoryPath
that will take you to the application folder of the currently running program
otherwise folders that are kept as variables, ex my docs ; desktop; temp;program files
are in the my.Computer .FileSystem .SpecialDirectories
Do you really want to build to your Program Files directory? You should create a deployment project. Then you can use the [ProgramFiles] as well as many other macros to deploy your application anywhere you want.

Resources