2013-09-27 5 views
3

코드를 사용하는 xbuild 코드를 컴파일하는 방법은 unsafe 코드입니까?안전하지 않은 코드를 사용하는 솔루션을 컴파일하는 방법은 무엇입니까?

Implementation/MaximumImageColorClassifier.cs(35,13): error CS0227: Unsafe code requires the `unsafe' command line option to be specified

그러나 실행 :

xbuild -unsafe [solution file]

나 :

현재이 오류를 얻을

MSBUILD: error MSBUILD0004: Too many project files specified

:

xbuild /unsafe [solution file]

오류를 제공

xbuild /? ... xbuild [options] [project-file]

그러나 더 unsafe 옵션, 일부 컴파일 플래그를 제공 할 "일반"옵션이 없다 :

xbuild 도움은 적절한 구문임을 보여줍니다.

나는이 질문을 보았습니다 : Can I pass an argument to msc through xbuild on the command line? 그러나 확실한 답이없고 안전하지 않은 코드에 대한 구체적인 해결 방법이 있습니까?

또한 내 경우 xbuilddmcs 컴파일러를 사용하고 있습니다.

답변

7

결국 솔루션 자체를 발견했습니다.

<AllowUnsafeBlocks>true</AllowUnsafeBlocks> 

파일 csproj에서을 (xbuild이 솔루션을 구축하기 위해 사용하는 구성 관련) 적절한 PropertyGroup 아래 : 그것은 넣어하는 것입니다. 그것은 정확하게 해석되고 unsafe 코드가 잘 컴파일됩니다.