I am trying to adopt FAKE in one of our older projects that uses TFS2013 as source control and exclusive check-out as check-out policy. I defined Targets for Clean, Build and RunTests, but I get stuck with the AssemblyInfo-Target. I get the following error (parts of the error message is in german, because I am developing on a german machine):
Running build failed.
Error:
System.UnauthorizedAccessException: Der Zugriff auf den Pfad "D:\SourcecodeTFS2013\AD ERP\AD ERP\ERP.PDFUTILITIES\My Project\AssemblyInfo.vb" wurde verweigert.
bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
bei System.IO.FileInfo.Delete()
bei Fake.AssemblyInfoFile.writeToFile(String outputFileName, IEnumerable`1 lines) in C:\code\fake\src\app\FakeLib\AssemblyInfoFile.fs:Zeile 134.
bei Fake.AssemblyInfoFile.CreateVisualBasicAssemblyInfoWithConfig(String outputFileName, IEnumerable`1 attributes, AssemblyInfoFileConfig config) in C:\code\fake\src\app\FakeLib\AssemblyInfoFile.fs:Zeile 233.
bei FSI_0005.Build.clo@47-2.Invoke(Tuple`4 tupledArg) in D:\SourcecodeTFS2013\AD ERP\AD ERP\build.fsx:Zeile 48.
bei Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source)
bei FSI_0005.Build.clo@27-1.Invoke(Unit _arg2) in D:\SourcecodeTFS2013\AD ERP\AD ERP\build.fsx:Zeile 47.
bei Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:Zeile 492
It seems that this error has to do with the exclusive check-out policy used for this project. That's why the AssemblyInfo.vb file is in “read-only” mode. Is there a possibility in FAKE to do a check-out of the AssemblyInfo.vb before generating the new one?
Here is my "AssemblyInfo"-Target (inspired from the build.fsx script of the Forge project: https://github.com/fsprojects/Forge ):
Target "AssemblyInfo" (fun _ ->
let getAssemblyInfoAttributes projectName =
[ Attribute.Title (projectName)
Attribute.Product project
Attribute.Description summary
Attribute.Company company
Attribute.CLSCompliant clsCompliant
Attribute.Version release.AssemblyVersion
Attribute.FileVersion release.AssemblyVersion ]
let getProjectDetails projectPath =
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
( projectPath,
projectName,
System.IO.Path.GetDirectoryName(projectPath),
(getAssemblyInfoAttributes projectName)
)
!! "../**/*.vbproj"
|> Seq.map getProjectDetails
|> Seq.iter (fun (projFileName, projectName, folderName, attributes) ->
CreateVisualBasicAssemblyInfo ((folderName @@ "My Project") @@ "AssemblyInfo.vb") attributes
)
)
I made something similar for updating packages with Paket:
https://gist.github.com/magicmonty/858066629b08c0e2e310
Have a look at the tfsHelper.fsx
I think this is similar: Any way to check-in into TFS from FAKE build target?
Else you could also change the file attributes before creating assemblyinfo.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.