F# Ionide - FAKE build "The system cannot find the path specified" - f#

I am working with F# on Windows with the Ionide plug-in. I can create a new F# project and load one of the example templates, e.g. "fslabjournal" or a class library.
Working in the script files seems fine, and everything in the default scripts works as expected. However, I cannot work out how to build anything. I would have thought that trying "FAKE: build" and choosing the "Clean" option would get me started, but all I get is a "The system cannot find the path specified." message.
Is this what I should expect to see when building default templates? Is there more setup to be done to these before a build can happen?

Related

Setting up a Rascal example project

How do I setup a Rascal-MPL project to consume the DSL built with Rascal?
I don't seem to find any resource that details how to solve that particular problem
The documentation hasn't been written for that case but here goes:
Use newRascalProject from util::Reflective to create a basic setup. For both the DSL project and the consuming project that makes sense.
mvn install in the DSL project, if you won't have the DSL project folder open in Eclipse or VScode or if you are working bare bones Unix/Maven.
In RASCAL.MF of the client project add Require-Libraries: |lib://dsl-project|
In pom.xml of the client project add a dependency on the DSL jar.
Restart the console or terminal for a file of the client project.
In the terminal the active version of the path configuration for the interpreter will be printed. It should have the DSL project in the list of srcs.
In VScode log for the Rascal LSP you can see the path configuration printed when compiling/checking source files in the client project. There the DSL project should be in the libs path.
If the DSL project isn't compiled to .tpl files that appear in the target folder and eventually in the jar, you will get spurious error messages in the client code. In that case trigger the compiler in the DSL project by saving the top module, or run mvn install again. Revisit the pom file for the settings of the rascal-maven-plugin
For those landing at this page and trying to find an example of calling newRascalProject with working parameters...
The first parameter is a 'location'. While it is documented how to use this parameter (https://www.rascal-mpl.org/docs/Rascal/Expressions/Values/Location/), it still took my some time to figure out that a location is not a regular string, and not using double quotes " but |.
So if you try:
newRascalProject ("home:///Projects/rascal_playground", "hello2")
You get the following error:
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UndeclaredVariable/UndeclaredVariable.html|
Including the variable name for the 2nd parameter...
newRascalProject ("home:///Projects/rascal_playground", name="hello")
... gives the same error.
This is the correct example:
newRascalProject (|home:///Projects/rascal_playground|, name="hello")

MSBuild builds solution but fails to build the project

I have F# project which I want to build with command line (to use that later in FAKE config).
The problem is that MSBuild fails to resolve assembly dependencies when I use it on the project file directly. While it goes fine when I use solution file with this single project included.
I really have run out of ideas. The solution file seems to not contain any critical information.
Another weird thing is that VSCode also fails to resolve one of those assemblies. I hope that when I fix MSBuild config I may be will able to see what's wrong with VSCode.
Command line:
"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" FSharpWeb1\FSharpWeb1.fsproj /t:rebuild
Error message:
C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\FSharpWeb1.fsproj(173,5): error MSB4062: The "MSBuild.ExtensionPack.FileSystem.File" task could not be loaded from the assembly C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\*Undefined*\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.dll. Could not load file or assembly 'file:///C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\*Undefined*\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.dll' or one of its dependencies. The filename, directory name, or volume label syntax is incorrect. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.Done Building Project "C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\FSharpWeb1.fsproj" (rebuild target(s)) -- FAILED.
I've pushed the minimal demo to github: https://github.com/alehro/testMSBuild.git
It's actually easy to reproduce independently. In VS 2015 Community edition create new project from F# Web Template named "Web Api 2.2" and then try to build it with MSBuild.
Another disturbing thing is that the minimal demo produces different errors from those I've seen yesterday. Also vscode complains on different items. If yesterday it could not resolve a couple of calls, now it complains on all of:
open System.Net.Http
open System.Web
open System.Web.Http
open System.Web.Routing
telling that neither of them is defined.
Reformatting my comments to a response now that it's verified it works:
Your FSharpWeb1.fsproj references MSBuild.ExtensionPack.FileSystem.File task from MSBuild.Extension.Pack, but the path specified in the <UsingTask> tag contains $(SolutionDir) property which is not defined when you run MSBuild outside of Visual Studio.
The error message you're getting shows that in the highlighted part of the path:
The "MSBuild.ExtensionPack.FileSystem.File" task could not be loaded from the assembly C:\work\MNP\testMSBuild1\FSharpWebApi\FSharpWeb1\*Undefined*\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.dll.
This can be remedied by conditionally setting the relative path when the property is not set by VS:
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
(original response for this solution: https://stackoverflow.com/a/33782131/1659828)
One more thing I mentioned in the comments is that this solution assumes you already have the necessary dependencies downloaded in the packages folder. Visual Studio does that automatically by restoring NuGet packages before build, but when you build in another context, you have to make sure the packages are restored, otherwise the build will keep failing.

NUnit tests with TFS 2013

I'm trying to get TFS to run my unit tests.
The name of the project assembly is Users.SystemTests.dll. It's located in ~/source/Users.SystemTests/bin/debug. The solution file is located in ~/source/Users.sln.
I've included the Nunit.VisualStudio.TestAdapter nuget package the in test assembly project.
The results of the build shows that the tests don't run.
What am I missing? They run fine locally via the Resharper test runner and I can also use nunit-console-x86.exe to run them.
Does this have something to do with the fact that I'm building a solution file? Maybe it's the output location being "AsConfigured?"
Ok, so I tracked this down on my own. It was twofold. The first problem was the the TestAdapter was not being output to the bin directory. The other piece was the Output Location. Setting copy local and then Output Location SingleFolder fixed the issue.
I do believe this is a bug in the tfs build. It works when you use SingleFolder or PerProject, but not AsConfigured. In the latter case the test runner don't find the testassemblies, and this is the same for both NUnit and MSTest, so it is not adapter specific.
The diagnostics log says:
Run VS Test Runner00:00:00
There were no matches for the search pattern C:\a\bin\**\*test*.dll
There were no matches for the search pattern C:\a\bin\**\*test*.appx

How to build multiple projects in a solution, each project with a different target?

I’m working with a VS2010 solution that has multiple projects (normal assemblies, an ASP.NET MVC project, a Windows Azure project, and a SQL project). I am trying to figure out how to set up a TFS build definition to deploy both the Windows Azure project and the SQL project.
I know how to do a Windows Azure deployment, and have a custom build task in the Windows Azure project file (.ccproj) that does the deployment. I can easily create a build definition that runs against the .ccproj file, passing in some MSBuild command line arguments as parameters, and works as expected.
I can create another build definition that runs against the SQL project (.sqlproj) file, passing to MSBuild the build targets and parameters needed to build and publish the SQL project. That works as expected.
As two distinct build definitions what I have works. Easy enough.
What I have yet to figure out is how to combine these two build definitions into one. Is that even possible (without a lot of work)? Ideally I’d be able to kick off a new build that will build the projects and deploy them both (just as they do as separate build definitions) as part of a single unit of work.
I have tried using the solution file as the item to build, and specifying the build targets as /t:<project>:<target>;<project>:<target>. But, apparently that syntax only works for targets in the base set and not any custom targets or those imported by other .targets files (or so that’s my understanding).
What is the best (simplest) way to accomplish what I’m looking to do?
Sure you can totally do this! Basically, you need to have a target in each project with the same name. Then you change the DependsOn list for each to include the project specific list of targets. Example:
Project 1:
<Target Name="MyBuild" DependsOnTargets="AzureTarget1,AzureTarget2" />
Project 2:
<Target Name="MyBuild" DependsOnTargets="SQLTarget1,SQLTarget2" />
Then you can tell the build definition to build the MyBuild target on each and it should invoke the appropriate DependsOn targets.
This is a very simple example of how to do this, but you can make this much more robust if you also use MSBuild Traversal projects and an MSBuild traversal task much like the method described in the following article under the "Building Large Source Trees" section:
http://msdn.microsoft.com/en-us/magazine/dd483291.aspx#id0100082

how do I use ant build to execute exportReleaseBuild task in Flash Builder 4

I'm trying to do an Ant build with FlashBuilder 4 for an Export Release Build. There is supposed to be a new (in FB4) ant task fb.exportReleaseBuild that will execute the release build. Reference to the usage is here:
http://help.adobe.com/en_US/flashbuilder/using/WSbde04e3d3e6474c4-59108b2e1215eb9d5e4-8000.html
When I include a target
..target name="exportRelease"
fb.exportReleaseBuild project="${flexproject}" ...
I generate an error indicating that the task can't be found:
Problem: failed to create task or type fb.exportReleaseBuild
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any presetde/macrodef declarations have taken place.
I look in flexTasks.jar and it doesn't include any flex.ant.exportReleaseBuild class despite having the latest jar.
Am I wrong in assuming I can run the exportReleaseBuild from an ant script?
You have probably solved this by now, but here's the answer in case someone else needs it.
The Ant compiler is telling you that it can't find the ExportReleaseBuild task. The reason is that when Ant is run from the IDE, it runs as a separate process to Flash Builder. When you run it from the command line it runs in the same process, which is why it works.
To get this to work in the IDE:
Open the build.xml file in Flash Builder
Go to Run -> External Tools -> External Tools Configuration...
Select Ant, then click the New Launch Configuration button
Enter a name for the build task
Select the Main tab:
Browse to the location of the build file
Browse to the location of the workspace
Select the JRE tab, then tick "run in the same JRE as this Workspace" (see image below)
Click Apply, then click Run
In future you can run the the task using the icon on the toolbar:
Just came across this situation myself, and after tweeting w/ #renaun (his blog post has some info as well: http://renaun.com/blog/2010/09/command-line-build-a-flash-builder-4-premium-feature/), it's pretty much useless for a CI build, unless you want to install FB4 premium, you can't run this task.
I was able to get it to run on my OSX environment by following the Adobe docs for it, but it doesn't mention that you have to basically run it from the command line tool. The ant that is installed as a plugin w/ the premium version has an importexport-ant.jar that is being referenced by Eclipse (standalone or plugin).
The only way I got it to run was via cmd line/terminal. It is tedious, and not really useful for a CI build. I did try to just grab the jar file, place it in the right spot, reference that in my ant script and build directly, but that made my compiler angry :(
I think I cracked it by setting up a shell script, and calling the shell script from an ant task.
This way you * are * using the headless Flash Builder modus, from within Flash Builder.
Full working example at:
https://gist.github.com/1077715
Thanks for the link lordB8r, that one got me thinking : )

Resources