.net-4.0

Crash when running a .NET 3.5 app on .NET 4

余生长醉 提交于 2019-12-24 10:40:18
问题 Our application is built using WinForms on .NET 3.5 This was tested specifically on Windows XP, although i am not sure whether it is OS related. Whenever i run it on a machine with .NET 4 only, it will crash, saying that it cannot find the .NET assemblies versioned 3.5. I am wondering why this does not happen automatically. For example, some 3rd party libraries install a policy of some sort, that when a newer version is installed, it will be used, even if your application was compiled against

Is it possible to specify the time zone on Windows Azure?

て烟熏妆下的殇ゞ 提交于 2019-12-24 09:59:11
问题 I am going to migrating a system to Windows Azure. And it will used UTC time for all existing function. Is there any way to set the time zone globally? Or I need to change all the code which display the time? My application will mainly serve in a specified timezone. I have try apply the culture and uiculture on web.config. And it does not work. Thanks. 回答1: As per the Windows Azure Team Blog - all the timing calculations/display etc have been moved to UTC.. https://azure.microsoft.com/en-us

'Check All' checkbox for a WPF DataGrid, where the checkboxes already have a source?

岁酱吖の 提交于 2019-12-24 09:48:19
问题 There is a WPF DataGrid with columns that have checkboxes. These checkboxes are already bound to some data source. What we want is a checkbox for each column that checks/unchecks all the checkboxes (and as a result updates the data source so that all the values are the same). Existing solutions on here work if there isn't an existing datasource - but we have effectively two, the 'select all' checkboxes and the actual data that the other checkboxes in the rows are bound to, if that makes sense

One of the assemblies in MS Expression Encoder SDK fails to resolve

≡放荡痞女 提交于 2019-12-24 08:18:51
问题 I have an year or so old application which uses Expression Encoder 3 to generate thumbnails. Few of the users are complaining that they are receiving the following exception: Could not load file or assembly 'Microsoft.Expression.Encoder.Utilities.dll' or one of its dependencies. This application has failed to start because the application configuration is incorrect. The application contains in itself the required EE3 assemblies in the setup, so as such installation of Expression Encoder is

Iterate with all elements and get text?

不羁的心 提交于 2019-12-24 07:58:13
问题 I am using the follow code to get all text from a page into a List<string> HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(content); foreach (var script in doc.DocumentNode.Descendants("script").ToArray()) script.Remove(); foreach (var style in doc.DocumentNode.Descendants("style").ToArray()) style.Remove(); foreach (HtmlAgilityPack.HtmlNode node in doc.DocumentNode.SelectNodes("//text()")) { string found = WebUtility.HtmlDecode(node.InnerText.Trim()); if

Path to resource files in a VS2010 project

早过忘川 提交于 2019-12-24 07:57:24
问题 I'm using VS 2010 and .NET 4.0. I've created a solution, with a single console C# project. I've added a few folders in the project via context menu on project > Add > New folder. Then I put some files in there. I now wish to get the path (or file handle) to one of those resources. Is there a nice way to getting its path? NOTE 1: The project is on a source control, so I need a way that will work on different file paths. NOTE 2: If possible, I don't want to use Directory.GetCurrentDirectory()

How to use the WcfClientBase helper class for WCF connections?

≡放荡痞女 提交于 2019-12-24 07:43:44
问题 Ufuk Hacıoğulları wrote a nice WCF helper class called WcfClientBase. However I've had some difficulty in implementing it. I defined my class as follows: public class ModelsBaseClass : ServiceClientBase<MemberServiceClient> {... And attempting to use the helper class in the following method that returns a complex object through Entity Framework: public static MyProject.DAL.Primary.Models.sq_newsfeed_GetProfileByID_Result GetAllProfileDetails(int profileID) { try { using (memberServiceClient =

VB6 applications can connect to SQL Server, but .NET applications can't

▼魔方 西西 提交于 2019-12-24 06:36:05
问题 Our system uses a combination of VB6 legacy applications and newer .NET applications. The applications are deployed to our clients, and they run the applications from a Terminal Server box, with the SQL Server database running on a different box. The VB6 applications work fine, while all of the .NET applications fail on startup (trying to connect to the database to read configuration information) every time with the error: System.Data.SqlClient.SqlException: A network-related or instance

Using Reflection to analyze Parameters and their values

天涯浪子 提交于 2019-12-24 05:34:20
问题 I've seen older posts here on SO, about one year old which would mean that they do not really cover .NET 4 or maybe even 3.5 on this topic. So here goes. If you with reflection were to fetch parameters for the current method ParameterInfo[] methodParams = MethodInfo.GetCurrentMethod().GetParameters(); Looping through each parameter will let you fetch the parameter-name however, there is only a "DefaultValue" which I guess is there because of the new Dynamic Parameters in .NET 4. However, my

How to assign properties generically using Expression.Assign selector with target type of object?

人走茶凉 提交于 2019-12-24 05:21:46
问题 I am trying to use an Expression selector to generically assign properties from one type of object to another where the properties are of various types. This is the code I have so far: var type1 = new Type1(); var type2 = new Type2(); ... var propMap = new List<Tuple<Expression<Func<Type1, object>>, Expression<Func<TradeStaticAttributesItemModel, object>>>> { new Tuple<Expression<Func<Type1, object>>, Expression<Func<Type2, object>>>(x => x.Prop1, x => x.Prop1), new Tuple<Expression<Func