Sharing Additional References and Namespace Imports with a team
I want to set up a default environment where LINQPad automatically references some of our assemblies and imports some commonly-used namespaces. I want to add this to source control, so that everyone on the team can easily start using this environment and we can track changes to it.
What I've done so far is to add LINQPad.exe to source control with a plugins sub-folder containig MyExtensions.FW46.linq, which contains relative paths, like this:
It seems to be relative to the working directory, so it works if I launch LINQPad.exe by double-clicking on it in Explorer, but not if I double-click a .linq file in another directory, for instance. Is there a better way to do this? For example, is there a special directory like for the location of LINQPad.exe? That would do the trick.
The other problem is namespace imports. Unlike References, the Namespace Imports configured for My Extensions don't seem to be applied to new queries. (I'm not sure why it's different.) Is there an easy way share Imports? I know I can click "Set as default for new queries", but that only saves them for me, not for everyone.
What I've done so far is to add LINQPad.exe to source control with a plugins sub-folder containig MyExtensions.FW46.linq, which contains relative paths, like this:
<Reference>..\..\Build\OurDll.dll</Reference>
It seems to be relative to the working directory, so it works if I launch LINQPad.exe by double-clicking on it in Explorer, but not if I double-click a .linq file in another directory, for instance. Is there a better way to do this? For example, is there a special directory like for the location of LINQPad.exe? That would do the trick.
The other problem is namespace imports. Unlike References, the Namespace Imports configured for My Extensions don't seem to be applied to new queries. (I'm not sure why it's different.) Is there an easy way share Imports? I know I can click "Set as default for new queries", but that only saves them for me, not for everyone.
Comments
%AppData%\LINQPad\DefaultQuery.xml
at LINQPad.ObjectModel.Query.get_FileReferences()
at LINQPad.ObjectModel.Query.ToQueryCore()
at LINQPad.ObjectModel.Query.get_QueryCore()
at LINQPad.ObjectModel.Query.set_NamespaceImports(IEnumerable`1 value)
Same if I try to set Util.CurrentQuery.FileReferences.
Regarding namespace imports, there's no solution to this right now. However, I can easily modify LINQPad so that it first looks for DefaultQuery.xml in the folder where LINQPad.exe is run, before looking in %userdata%\LINQPad. This would solve your problem, because DefaultQuery.xml contains default namespaces and references for new queries. However, your users would still need to start LINQPad by double-clicking your special copy of LINQPad.exe, rather than double-clicking a .LINQ file.
This overrides the default file association and doesn't require you to (e.g.) create a batch script for every LINQ file.
Make sure LINQPad.exe is not running because it won't start a new instance if so.
As with the 'Plugins' folder, it would be great if the DefaultQuery.xml would be used when placed in the execution folder.
<RuntimeDirectory>
for the location of LINQPad.exe? The forum software seems to have swallowed the "HTML tag", completely changing the meaning. In other words, I'm looking for a way to make the reference paths relative to the LINQPad.exe path, rather than to the working directory.> I can easily modify LINQPad so that it first looks for DefaultQuery.xml in the folder where LINQPad.exe is run
Yes, I think this would be a good start.
A potential problem is that it would make it hard for users to override the team-shared settings if they want to. Ideally, DefaultQuery.xml in the LINQPad.exe directory would be the default, but users would have a way to say "no, use my settings" (i.e. the DefaultQuery.xml in %APPDATA%).
I guess a workaround would be to add a batch file that changes the working directory to its own location (
CD "%~dp0"
) and then runs LINQPad.exe.http://www.linqpad.net/download.aspx#beta
I've also now written documentation on xcopy-deployment:
http://www.linqpad.net/PortableDeployment.aspx