Publish web application with unsafe code

后端 未结 3 1246
旧时难觅i
旧时难觅i 2021-01-06 00:26

I\'m trying to publish a web application (with VS2012 Web) in which I need to run a vb script.

That script currently doesn\'t run correctly probably because of the l

相关标签:
3条回答
  • 2021-01-06 00:50

    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.

    0 讨论(0)
  • 2021-01-06 01:07

    It's very simple to publish with a unsafe code

    Here is how you do it: enter image description here

    0 讨论(0)
  • 2021-01-06 01:11

    Please add this code in Web.config file and check it is working for you

    <compilers>
    <compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/unsafe" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </compilers>
    
    0 讨论(0)
提交回复
热议问题