Rank: Newbie
Groups: Registered
Joined: 4/4/2012(UTC) Posts: 2 Location: Stockholm, Sweden
Was thanked: 1 time(s) in 1 post(s)
|
When NCrunch is building my project, it fails to find the input for for a Custom Task. The .csproj employs a Custom Task generating .g.cs files. It seams that it fails to copy the source file. Code:
<Project xmlns="(- BROKEN LINK -)">
<PropertyGroup>
<CoreCompileDependsOn>$(CoreCompileDependsOn);AppOutput</CoreCompileDependsOn>
</PropertyGroup>
<ItemGroup>
<AvailableItemName Include="App"/>
</ItemGroup>
<UsingTask TaskName="JsTemplateToCs.GenerateCodeFromXyzFiles" AssemblyFile="Z:\Dropbox\Starcounter\HelloWeb\JsTemplateToCs\bin\Debug\JsTemplateToCs14.dll" />
<Target Name="AppOutput" Inputs="@(App)" Outputs="@(App->'$(IntermediateOutputPath)%(FileName)%(Extension).g.cs')">
<GenerateCodeFromXyzFiles
InputFiles="@(App)"
OutputFiles="@(App->'$(IntermediateOutputPath)%(FileName)%(Extension).g.cs')">
<Output TaskParameter="OutputFiles" ItemName="gFiles" />
</GenerateCodeFromXyzFiles>
<ItemGroup>
<Compile Include="@(gFiles)" />
</ItemGroup>
</Target>
</Project>
Code:
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.IO;
using Starcounter.Template;
namespace JsTemplateToCs
{
public class GenerateCodeFromXyzFiles : Task, ITask
{
[Required]
public ITaskItem[] InputFiles { get; set; }
[Output]
public ITaskItem[] OutputFiles { get; set; }
public override bool Execute()
{
for (int i = 0; i < InputFiles.Length; i++) {
Log.LogMessage("Creating " + OutputFiles[i].ItemSpec);
File.WriteAllText(OutputFiles[i].ItemSpec,
ProcessXyzFile(
File.ReadAllText(InputFiles[i].ItemSpec)));
}
return true;
}
private string ProcessXyzFile(string xyzFileContents) {
return AppTemplate.CreateFromJs(xyzFileContents, false).GenerateCsCode();
}
}
}
Code:
NCrunch: If you are experiencing problems in getting this project to build, have a look at https://www.ncrunch.net/documentation/troubleshooting_project-build-issues
C:\Users\Administrator\AppData\Local\NCrunch\3532\8\Starcounter\HelloWeb\HelloWeb\StarcounterApp.targets (13): The "GenerateCodeFromXyzFiles" task failed unexpectedly.
System.IO.FileNotFoundException: [b]Could not find file 'C:\Users\Administrator\AppData\Local\NCrunch\3532\8\Starcounter\HelloWeb\HelloWeb\crm.js'.
File name: 'C:\Users\Administrator\AppData\Local\NCrunch\3532\8\Starcounter\HelloWeb\HelloWeb\crm.js'[/b]
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
at System.IO.File.ReadAllText(String path)
at JsTemplateToCs.GenerateCodeFromXyzFiles.Execute() in C:\Dropbox\Starcounter\HelloWeb\JsTemplateToCs\Class1.cs:line 21
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__2f.MoveNext()
|