簡體   English   中英

如何在 Visual Studio 2015 中將 c# csproj 編譯成 exe - 錯誤 CS0579

[英]How to compile c# csproj into exe in Visual Studio 2015 - error CS0579

C# 和 Visual Studio 非常新。 我從需要修改的 .exe 開始,在 .NET Reflector 中對其進行反編譯,然后在 Visual Studio 2015 中打開程序集。我進行了更改並單擊了“構建”,現在出現兩個錯誤,代碼為“CS0579... 說明: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' 屬性”(第二個是相同的,但沒有 'global::')

我還沒有 10 的聲望,所以我不能發布我的截圖。

需要克服這一點。 歡迎任何幫助。 謝謝!

您應該從 AssemblyInfo.cs 中刪除這一整行:

[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.0,Profile=Cl‌​ient", FrameworkDisplayName=".NET Framework 4 Client Profile")] 

我今天遇到了與某些 AssemblyInfo 和 TargetFrameworkAttribute 重復值相關的錯誤 CS0579。 使用 sdk 3.1.301 並針對 netcoreapp3.1 以及其他一些針對 netstandard2.1 的項目

使用這個:

    <PropertyGroup>
        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
        <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
    </PropertyGroup>

刪除 /bin 和 /obj 修復了我的構建。

global::System.Runtime.Versioning.TargetFrameworkAttribute' 屬性

[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.0,Profile=Cl‌​ient", FrameworkDisplayName=".NET Framework 4 Client Profile")] 

您可以直接從項目中刪除行。 要刪除單擊並導航錯誤,然后刪除此行,然后構建程序並再次運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM