C# 使用nuget pack获得包含某些不安全代码的解决方案时出错

C# 使用nuget pack获得包含某些不安全代码的解决方案时出错,c#,nuget,unsafe,pack,C#,Nuget,Unsafe,Pack,我目前正试图用一些不安全的代码为解决方案打包一个nuget包。 MSBuild运行良好,因为我可以为它提供以下参数:/p:AllowUnsafeBlocks=true 我尝试了几种方法为我的nuget.exe pack命令提供相同的参数 ".\.nuget\nuget.exe" pack "My.csproj" -Build -IncludeReferencedProjects -Version 02.06.5 -verbosity detailed -suffix UAT -Propertie

我目前正试图用一些不安全的代码为解决方案打包一个nuget包。 MSBuild运行良好,因为我可以为它提供以下参数:
/p:AllowUnsafeBlocks=true

我尝试了几种方法为我的nuget.exe pack命令提供相同的参数

".\.nuget\nuget.exe" pack "My.csproj" -Build -IncludeReferencedProjects -Version 02.06.5 -verbosity detailed -suffix UAT -Properties "Configuration=Release AllowUnsafeBlocks=true" 


".\.nuget\nuget.exe" pack "My.csproj" -Build -IncludeReferencedProjects -Version 02.06.5 -verbosity detailed -suffix UAT -Properties "Configuration=Release" "AllowUnsafeBlocks=true"
我得到以下错误:

error CS0227: Unsafe code may only appear if compiling with /unsafe

编辑:由于解决方案设置良好,VS运行良好:)

解决方案非常简单。。。。 加上“;”在每个属性之间-属性参数

".\.nuget\nuget.exe" pack "My.csproj" -Build -IncludeReferencedProjects -Version 02.06.5 -verbosity detailed -suffix UAT -Properties "Configuration=Release;AllowUnsafeBlocks=true"

您是否允许在项目属性中使用不安全的代码?是的,我允许了,否则我将无法直接从VS2019:)生成它,在任何其他引用它的项目中也可以这样做吗?您可能应该在MSBuild之后添加“(from VS)”,因为这对每个人(包括我,我的坏朋友)都不清楚。我想你已经看过了?是的,我没有发现任何与不安全有关的东西: