[英]How to make VS2019 not create folder 'net5.0' for building project?
[英]How to allow unsafe code for Release and Debug on visual studio 2019 .net5.0
我查看了這個問題,詢問如何允許 azure 函數發布代碼的不安全代碼。
這建議"Make sure you set the Allows unsafe code for the Release build as well."
我已經在Project Properties -> Build -> Check Allow unsafe code上啟用了不安全模式。
但我沒有發現在Debug和Release上啟用不安全代碼之間的區別。
我使用的是 Visual Studio 2019 .Net 5.0
在 Release 上啟用它的路徑在哪里?
無論您使用什么 IDE,您都可以通過將屬性組添加到您的 csproj 文件來激活它,就像在本示例中為Release
和Debug
所做的那樣。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</Project>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.