msbuild
似乎不允许我构建unsafe
块,即使我的.csproj
指定了:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
...
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
我的构建命令是:
msbuild myProject.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Clean,Build
答案 0 :(得分:6)
您显示已为 Debug 配置设置了该属性。一个选项是 Release 配置缺少它。
您还在命令行上将平台指定为"Any CPU"
(带空格),而构建文件需要"AnyCPU"
。这也可能导致它无法被接收。
答案 1 :(得分:4)
我将while True:
spam = int(input())
if spam == 1:
print('Hello')
if spam == 2:
print('Howdy')
else:
print('Greeting')
break
添加到/p:AllowUnsafeBlocks=true
命令,如下所示:
MSBuild
如果您在VSTS中,则可以在参数中包含MSBuild some-project.csproj /p:AllowUnsafeBlocks=true
。
这适合我。