简体   繁体   中英

Unable to Publish WCF Service with Unsafe code in Visual Studio 2013

This might be same problem as mentioned in the following link Publish web application with unsafe code

I have a wcf service with a block of Unsafe code. I have Allowed Unsafe Code in My Project properties. The Application is able build properly where as it is unable to publish the project. It Says Unsafe code may only appear if compiling with /unsafe error during the publishing the project. and finally says build failed.

I feel its strange because it is able build the project successfully but failed in publishing.

I have tried the following help link but not worked for me.

how to add unsafe keyword in web based asp.net application c#

It seems when you publish it ignores the project setting of unsafe, so you need to manually open your .CSPROJ file and include:

  <PropertyGroup>
    ...
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

That solved it for me.

Googled this issue but could not find anything. Checked the *.targets files for "unsafe" which led me to the "AllowUnsafeBlocks" tag. Definately a bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM