2 回答

TA贡献1943条经验 获得超7个赞
我刚刚遇到了同样的问题,dotnet pack
没有为.csproj
使用该包的文件生成Microsoft.Functions.SDK
包。
dotnet pack
允许您提供MSBuild
受尊重的参数,即使它没有出现在他们的文档中,因此您可以nuget
通过在命令行上执行以下操作来强制生成包:
dotnet pack --configuration Release -property:IsPackable=true
函数 SDK 中似乎有一些代码我没有花时间去追踪强制该IsPackable
标志为 false 的代码,无论.csproj
.
如果您将来遇到这些问题,您可以通过将(将详细程度设置为调试)dotnet
附加到命令行命令来查看命令的诊断。-v=d

TA贡献2080条经验 获得超4个赞
第一步:打开项目文件夹
第二步:打开cmd
第 5 步:您应该看到一个指向您的项目而不是解决方案目录的 cmd
第 6 步:复制并粘贴流动的命令
PowerShell -Command "Get-ChildItem $dir | Where { $_.Name -match '.csproj'} | Select -Expand Name | out-file -encoding ASCII projectname"
SET /p projectname=<projectname
PowerShell -Command "(Get-Content -path ..\packages\Microsoft.NET.Sdk.Functions.1.0.24\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets -Raw) -replace 'DependsOnTargets="""RunResolvePublishAssemblies"""', '' | Set-Content -Path ..\packages\Microsoft.NET.Sdk.Functions.1.0.24\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets"
SET MSBuild_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
SET PATH=%MSBuild_PATH%;%PATH%
MSbuild %projectname% /t:Clean;Rebuild /p:Configuration=Release
PowerShell -Command "Get-ChildItem -Path .\bin\Release\bin -Recurse | Copy-Item -Destination .\bin\Release "
PowerShell -Command "if(!(Test-Path -Path 'nuget.exe')){(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','nuget.exe')}"
NuGet.exe pack %projectname% -Prop Configuration=Release -MSBuildPath "%MSBuild_PATH%"
start .
第 7 步:你应该找到你的 nupkg 文件
- 2 回答
- 0 关注
- 135 浏览
添加回答
举报