2 回答

TA貢獻(xiàn)1943條經(jīng)驗(yàn) 獲得超7個(gè)贊
我剛剛遇到了同樣的問題,dotnet pack
沒有為.csproj
使用該包的文件生成Microsoft.Functions.SDK
包。
dotnet pack
允許您提供MSBuild
受尊重的參數(shù),即使它沒有出現(xiàn)在他們的文檔中,因此您可以nuget
通過在命令行上執(zhí)行以下操作來強(qiáng)制生成包:
dotnet pack --configuration Release -property:IsPackable=true
函數(shù) SDK 中似乎有一些代碼我沒有花時(shí)間去追蹤強(qiáng)制該IsPackable
標(biāo)志為 false 的代碼,無論.csproj
.
如果您將來遇到這些問題,您可以通過將(將詳細(xì)程度設(shè)置為調(diào)試)dotnet
附加到命令行命令來查看命令的診斷。-v=d

TA貢獻(xiàn)2080條經(jīng)驗(yàn) 獲得超4個(gè)贊
第一步:打開項(xiàng)目文件夾
第二步:打開cmd
第 5 步:您應(yīng)該看到一個(gè)指向您的項(xiàng)目而不是解決方案目錄的 cmd
第 6 步:復(fù)制并粘貼流動(dòng)的命令
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 步:你應(yīng)該找到你的 nupkg 文件
- 2 回答
- 0 關(guān)注
- 116 瀏覽
添加回答
舉報(bào)