PSake 执行 MSBuild 命令时出错

发布于 2024-09-10 14:37:49 字数 2107 浏览 6 评论 0原文

我的解决方案中有 3 个项目, 一个 WPFApplication 和 2 个 ClassLibrary 项目 当我构建解决方案时,我收到以下错误......

properties { 
    $base_dir = resolve-path . 
    $build_dir = "$base_dir\build" 
    $buildartifacts_dir = "$build_dir\BuildArtifacts" 
    $sln_file = "$base_dir\Hello.sln" 
} 

task default -depends Compile 

task Clean { 
    Write-Host "Cleaning solution" -ForegroundColor Green 
    remove-item -force -recurse $buildartifacts_dir -ErrorAction 
SilentlyContinue 
} 

task Init -depends Clean { 
    Write-Host "Creating BuildArtifacts directory" -ForegroundColor Green 
    new-item $buildartifacts_dir -itemType directory 
} 


task Compile -depend Init { 
   Write-Host "Compiling ---" $sln_file -ForegroundColor Green 
   Exec { msbuild $sln_file "/p:OutDir=$build_artifacts_dir" 
/p:Configuration=Release /v:quiet } 

} 

我收到以下错误 - 我做错了什么?

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868,9): 错误 MSB3023:未指定复制目标。请提供“DestinationFiles”或“DestinationFolder”。 [D:\Nusrofe\GrokPSake2\ClassLibrary1\ClassLibrary1.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3471,9): 错误 MSB4044:未给出“FindUnderPath”任务 所需参数“Path”的值。 [D:\Nusrofe\GrokPSake2\ClassLibrary1\ClassLibrary1.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868,9): 错误 MSB3023:未指定复制目标。普莱 ase 提供“DestinationFiles”或“DestinationFolder”。 [D:\Nusrofe\GrokPSake2\ClassLibrary2\ClassLibrary2.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3471,9): 错误 MSB4044:未给出“FindUnderPath”任务 所需参数“Path”的值。 [D:\Nusrofe\GrokPSake2\ClassLibrary2\ClassLibrary2.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3471,9): 错误 MSB4044:未给出“FindUnderPath”任务 所需参数“Path”的值。 [D:\Nusrofe\GrokPSake2\WpfApp\WpfApp.csproj]


build2.ps1:执行命令时出错:msbuild $sln_file “/p:OutDir=$build_artifacts_dir”/p:Configuration=Release /v:quiet

谢谢 -- 科尔库

I have 3 projects in the solution,
A WPFApplication and 2 ClassLibrary projects
When i build the Solution i get error below..

properties { 
    $base_dir = resolve-path . 
    $build_dir = "$base_dir\build" 
    $buildartifacts_dir = "$build_dir\BuildArtifacts" 
    $sln_file = "$base_dir\Hello.sln" 
} 

task default -depends Compile 

task Clean { 
    Write-Host "Cleaning solution" -ForegroundColor Green 
    remove-item -force -recurse $buildartifacts_dir -ErrorAction 
SilentlyContinue 
} 

task Init -depends Clean { 
    Write-Host "Creating BuildArtifacts directory" -ForegroundColor Green 
    new-item $buildartifacts_dir -itemType directory 
} 


task Compile -depend Init { 
   Write-Host "Compiling ---" $sln_file -ForegroundColor Green 
   Exec { msbuild $sln_file "/p:OutDir=$build_artifacts_dir" 
/p:Configuration=Release /v:quiet } 

} 

i get the following error's -- what am i doing wrong?

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868­,9):
error MSB3023: No destination specified for Copy. Please supply either "DestinationFiles" or "DestinationFolder". [D:\Nusrofe\GrokPSake2\ClassLibrary1\ClassLibrary1.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3471­,9):
error MSB4044: The "FindUnderPath" task was not given
a value for the required parameter "Path". [D:\Nusrofe\GrokPSake2\ClassLibrary1\ClassLibrary1.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868­,9):
error MSB3023: No destination specified for Copy. Ple
ase supply either "DestinationFiles" or "DestinationFolder". [D:\Nusrofe\GrokPSake2\ClassLibrary2\ClassLibrary2.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3471­,9):
error MSB4044: The "FindUnderPath" task was not given
a value for the required parameter "Path". [D:\Nusrofe\GrokPSake2\ClassLibrary2\ClassLibrary2.csproj]

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3471­,9):
error MSB4044: The "FindUnderPath" task was not given
a value for the required parameter "Path". [D:\Nusrofe\GrokPSake2\WpfApp\WpfApp.csproj]


build2.ps1:Error executing command: msbuild $sln_file
"/p:OutDir=$build_artifacts_dir" /p:Configuration=Release /v:quiet

Thanks --
Corku

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜扑 2024-09-17 14:37:49

看起来在您的 Compile 任务中,您的 $buildartifacts_dir 变量中有一个杂散的下划线。 MSBuild 可能不知道该怎么做,因为本质上您正在为 OutDir 传递一个空位置。

Looks like in your Compile task you have a stray underscore in your $buildartifacts_dir variable. MSBuild probably doesn't know what to do because essentially you are passing it an empty location for the OutDir.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文