我为使用Net Framework 4.5.2运行的Wpf应用程序配置了ClickOnce部署。它在Windows 7上运行得很好,但是当尝试在Windows 10上运行时,它会抛出错误 “在此操作系统中不允许使用Microsoft .NET Framework 4.5.2”(由于消息以西班牙语显示,因此自己的翻译)。
我知道Windows 10附带了更高的Net Framework版本。我尝试修改config.xml bootstrapper的文件添加这个条件
func uploadMultiPartData(data: Data? , inURL : String? , parameters : [String : Any] , file_name : NSString , onCompletion: @escaping ServiceResponse){
var url : String!
url = inURL
var header : [String : String]?
header = ["contentType" : "\(file_name.deletingPathExtension)/\(file_name.pathExtension)"]
let URL = try! URLRequest(url: url!, method: .put, headers: header)
Alamofire.upload(multipartFormData: { (multipartFormData) in
for (key, value) in parameters {
if let vl = value as? String {
multipartFormData.append(vl.data(using: .utf8)!, withName: key)
} else if let vl = value as? Int {
multipartFormData.append(String(vl).data(using: .utf8)!, withName: key)
}
}
if let data = parameters["data"] as? Data {
multipartFormData.append(data, withName: file_name as String )
}
}, with: URL, encodingCompletion: { (result) in
switch result{
case .success(let upload, _, _):
upload.responseString { response in
(response.response?.allHeaderFields)!)
var dataSource : AnyObject?
if response.error != nil{
return
}
}
case .failure(let error):
print("Error in upload: \(error.localizedDescription)")
}
})
}
但错误仍然存在。