Paket 访问被拒绝在 Fake 上



当Paket尝试为我的项目打包dll时,我遇到了问题,我只是得到一个"Paket失败:对路径的访问被拒绝",我有以下配置

在 VisualStudio 的构建后事件中,我调用一个 bat 文件来调用脚本进行伪造

构建.bat

@ECHO off
cls
SET TargetName=%1
SET BuildMode=%2
SET SolutionDir=%~dp0
rem Get latests version of Paket
"%~dp0.paketpaket.bootstrapper.exe"
IF errorlevel 1 (
    ECHO error on paket.bootstrapper
)
rem Download the dependencies specified by the paket.lock file into the packages/ directory. 
"%~dp0.paketpaket.exe" restore
IF errorlevel 1 (
    ECHO error on paket.restore
)
rem ECHO Starting FAKE build.fsx
"%SolutionDir%packagesFAKEtoolsFAKE.exe" "%SolutionDir%buildPackage.fsx" -ev TargetName %TargetName% -ev BuildMode %BuildMode% -ev SolutionDir "%SolutionDir%

build.fsx

open Fake.AssemblyInfoFile
open System
open Paket
//CommandLineArguments
let TargetName = Environment.GetEnvironmentVariable("TargetName")    
let SolutionDir = Environment.GetEnvironmentVariable("SolutionDir")
let BuildMode = Environment.GetEnvironmentVariable("BuildMode")
//Paths
let AssemblyFilePath = SolutionDir + TargetName + @"PropertiesAssemblyInfo.cs"
let PaketPath = SolutionDir + @".paketpaket.exe"
let PaketOutPath = @"X:nuget" + TargetName
let buildDir = SolutionDir + TargetName + @"binFake" + BuildMode
//Constants
let constantSolution = SolutionDir + TargetName + @"" + TargetName + ".csproj"
//Functions
let GetVersion = 
    GetAttributeValue "AssemblyVersion" AssemblyFilePath
//Targets
Target "Clean" (fun _ ->
        Console.WriteLine ("Cleaning up")
        CleanDir buildDir
)
Target "BuildApp" (fun _ ->
    Console.WriteLine("Building application on " + buildDir)
    if BuildMode = "Debug" then MSBuildDebug buildDir "Build" !! constantSolution
                                    |> Log "AppBuild-Output:" 
    else MSBuildRelease buildDir "Build" !! constantSolution
            |>Log "AppBuild-Output"
)
Target "CreatePackage" (fun _ ->
    Pack (fun p ->
        {p with
            Version = GetVersion.Value
            OutputPath = PaketOutPath
            BuildConfig = BuildMode
            ToolPath = PaketPath
            TemplateFile = SolutionDir + TargetName
            BuildPlatform = "x86"
            WorkingDir = buildDir
        })
)
Dependencies
"Clean"
    ==> "BuildApp"
    ==> "CreatePackage"
RunTargetOrDefault "CreatePackage"

我在这里完全迷失了,谷歌也无济于事,知道为什么 paket 会失败吗?提前感谢,任何想法都会好起来的。

发现问题...在目标"创建包"中,我在模板文件字段上使用了该文件的路径,不包括文件的实际名称

这是"修复"

Target "CreatePackage" (fun _ ->
    Pack (fun p ->
        {p with
            Version = GetVersion.Value
            OutputPath = PaketOutPath
            BuildConfig = BuildMode
            ToolPath = PaketPath
            TemplateFile = SolutionDir + TargetName + @"paket.template"
            BuildPlatform = "x86"
            WorkingDir = buildDir
        })
)

相关内容

  • 没有找到相关文章

最新更新