2
我有一個用C#/ .NET編寫的小命令行應用程序。我需要它在.NET 3.5或更高版本安裝在操作系統上時運行。安裝4.x時提示安裝.NET 3.5的Windows
要做到這一點,我在app.config包含以下內容:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
該項目框架設置好的來」的.NET Framework 3.5" 。
從我的理解,這兩個設置應該向後兼容,以便當某人沒有安裝3.5,但已安裝4.x,它將繼續工作。
還有什麼我不見了?從我的研究中,我認爲我已經把所有這些東西組合在一起,以實現這一點。
編輯:根據下面的問題,這裏也是參考和使用語句。有沒有第三方組件
以下是在項目引用:
System.Core
System.Web.Extensions
System.Windows.Forms
和以下是我使用的語句:
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Security.Cryptography;
using System.Web.Script.Serialization;
using System.Reflection;
using System.Diagnostics;
你有第三方組件? –
我不會,我會添加引用和使用原來的問題 – Josh
嘗試添加'sku',http://stackoverflow.com/questions/6739412/require-the-net-4-0-full-profile- with-supportedruntime –