8

I use teamcity to build Sharepoint projects using 64-bit MSBuild. All projects work fine instead of my workflow project. When using Framework 4.0 I get the error message

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Workflow.Targets(121,5): error MSB4018: The "CompileWorkflowTask" task failed unexpectedly. [V:\Workflows\MyCustomer.WFs.TranslationWorkflow\MyCustomer.WFs.TranslationWorkflow\MyCustomer.WFs.TranslationWorkflow.csproj] c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Workflow.Targets(121,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\vjwduioy.tmp'. [V:\Workflows\MyCustomer.WFs.TranslationWorkflow\MyCustomer.WFs.TranslationWorkflow\MyCustomer.WFs.TranslationWorkflow.csproj]

I remembered that microsoft got rid of the old Workflow mechanism so I expected that it possibly only works with the older 3.5 framework and built the project with that but got another error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets(37,45): error MSB4019: The imported project "C:\Windows\Microsoft.NET\Framework64\v3.5\Workflow.Targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

In Visual studio 2010 building works just fine.

Mathias F
  • 15,906
  • 22
  • 89
  • 159
Ole Albers
  • 8,715
  • 10
  • 73
  • 166

2 Answers2

6

Found a solution: I had to create a folder in 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\'

This seemed to be a complete TeamCity-issue

Ole Albers
  • 8,715
  • 10
  • 73
  • 166
  • 2
    Create what folder? With what name? With what inside it? – Shaggydog Aug 21 '13 at 14:38
  • Sorry. Too long ago. I can't remember. (Somehow feel like a politician, now :) ) – Ole Albers Aug 22 '13 at 07:46
  • 1
    Had the same problem with TeamCity, to describe it more precisely 'Temp' must be present in 'C:\Windows\system32\config\systemprofile\AppData\Local' folder – Gatis Bergšpics Aug 19 '14 at 11:34
  • For what it's worth, it's December 2014 and I am having the same exact problem with TeamCity 8.1.5(build 30240). However, creating the folder didn't solve the problem for me. – Tundey Dec 02 '14 at 14:25
  • 3
    what worked for me was switching the TeamCity windows services to use my credentials instead of LocalSystem – Tundey Dec 02 '14 at 18:52
  • we have to try also to create `"C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Temp"` because of the file system redirection. See [m.richardson](https://social.msdn.microsoft.com/Forums/vstudio/en-US/70f80ccd-9e15-49db-94ea-4564dfc1e593/msbuild-failure-what-permissions-are-needed-to-build-workflow-projects-compileworkflowtask?forum=msbuild) on MSDN. I'll try it out soon. – it3xl Jan 10 '17 at 22:33
  • sorry, SysWOW64 leads to using [MSBuild x64 version](https://connect.microsoft.com/VisualStudio/feedback/details/1580569/32-bit-msbuild-exe-running-as-local-system-calls-64-bit-vbcscompiler-exe-causing-csc-error-cs2001-source-file-file-could-not-be-found). It is the newest bug from 07-2016 – it3xl Jan 11 '17 at 08:28
0

Solved by modifying of CMD environment.

The adding of C:\Windows\system32\config\systemprofile\AppData\Local\Temp\ did not help me.

And C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Temp‌ too.
Even more, after adding the \Temp folder under \SysWOW64... I was forced to use MSBuild x64 because of a new weird bug VBCSCompiler.exe causing CSC : error CS2001: Source file ... could not be found

Also I can't use MSBuild x64 all the time.
I can't use MSBuild x64 through DevEnv.com to build Visual Studio setup projects. DevEnv allows only to use x32 MSBuild.

Hopefully I have found a funny way to solve all these errors.
I have changed profile folder for CMD calls by override environment variables of CMD such as AppData and others.

Here is the full and working version of it - MSBuild-File-System-Redirector-fail-System32-to-SysWOW64

And sorry, but you can't use it without Wrapping a call of MSBuild and DevEnv by a batch file. Or the same from this answer.

it3xl
  • 2,372
  • 27
  • 37