#564 – Other Places to Get Third Party Effects
An effect in WPF changes the appearance of a visual element. The .NET Framework comes with only a couple of effects, but you can find a few other third party effects on the web.
WPF Pixel Shader Effects Library – 23 different effects, demo here
DotWay.WPF Controls – Includes a few interesting effects
Here are some of the effects from the Pixel Shader Effects Library:
Read more: 2,000 Things You Should Know About WPF
QR:
Microsoft Security Bulletin MS12-035 - Critical
Posted by
jasper22
at
15:43
|
Vulnerabilities in .NET Framework Could Allow Remote Code Execution (2693777)
Published: Tuesday, May 08, 2012 | Updated: Tuesday, May 22, 2012
Version: 2.1
General Information
Executive Summary
This security update resolves two privately reported vulnerabilities in the .NET Framework. The vulnerabilities could allow remote code execution on a client system if a user views a specially crafted webpage using a web browser that can run XAML Browser Applications (XBAPs). Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.
This security update is rated Critical for all supported editions of the Microsoft .NET Framework on all supported editions of Microsoft Windows. For more information, see the subsection, Affected and Non-Affected Software, in this section.
The security update addresses the vulnerabilities by correcting the manner in which the .NET Framework serialization process handles trusted and untrusted data. For more information about the vulnerabilities, see the Frequently Asked Questions (FAQ) subsection for the specific vulnerability entry under the next section, Vulnerability Information.
Recommendation. The majority of customers have automatic updating enabled and will not need to take any action because this security update will be downloaded and installed automatically. Customers who have not enabled automatic updating need to check for updates and install this update manually. For information about specific configuration options in automatic updating, see Microsoft Knowledge Base Article 294871.
For administrators and enterprise installations, or end users who want to install this security update manually, Microsoft recommends that customers apply the update immediately using update management software, or by checking for updates using the Microsoft Update service.
See also the section, Detection and Deployment Tools and Guidance, later in this bulletin.
Read more: Security TechCenter
QR:
.NET 4.5 Baby Steps, Part 6: ISourceBlock
Posted by
jasper22
at
11:47
|
Introduction
We have spent a number of posts looking at IDataFlowBlock, BatchedBlocks and some other interesting blocks but as a final interesting bit for blocks is the ISourceBlock interface which is implemented on the “publisher” like blocks and it has a very interesting method: LinkTo. The goal of LinkTo is to chain blocks together to do interesting and amazing things!
It's in the name
The final interesting point, and likely the most important is in the name of the assembly all this goodness comes from: System.Threading.Tasks.DataFlow. All of this is handled my multiple tasks (and likely multiple threads) under the covers without you needing to worry about it. When we look at the TPL in .NET 4 and how it made working with multi-threaded processing easier, the final goal of this is to make multi-threaded data processing easier - and it does!
static BufferBlock<DateTime> bufferPublisher = new BufferBlock<DateTime>();
static TransformBlock<DateTime, string> transformPublisher = new TransformBlock<DateTime, string>(d =>
{
return d.ToLongTimeString();
});
static BatchBlock<string> batchPublisher = new BatchBlock<string>(5);
static ActionBlock<string[]> subscriber1 = new ActionBlock<string[]>(s =>
{
Console.WriteLine("Subscriber 1: {0}", s);
});
static ActionBlock<string[]> subscriber2 = new ActionBlock<string[]>(s =>
{
Console.WriteLine("Subscriber 2: {0}", s);
});
static ActionBlock<string[]> subscriber3 = new ActionBlock<string[]>(s =>
{
Console.WriteLine("Subscriber 3: {0}", s);
});
static void Main(string[] args)
{
batchPublisher.AsObservable().Subscribe(subscriber1.AsObserver());
batchPublisher.AsObservable().Subscribe(subscriber2.AsObserver());
Read more: DZone .NET Zone
QR:
IIS: Handling WCF Client Certificate
Posted by
jasper22
at
11:44
|
WCF - TRANSPORT SECURITY – IIS - HANDLING CLIENT CERTIFICATES
1:1 Mapping -2003
Performs the client certificate authentication and maps it to windows account.
Once the client certificate is mapped, it is authorized based on the windows account / identity associated with it.
Requirement:
Client certificate with Public key – so that it can be attached to user Identity.
Windows identity – which will be used to authorize the access to the service / application.
Steps
IIS -> Web Site -> Properties -> Directory Security -> Secure Communication - > Enable client certificate mapping
Add -> Select the certificate with Public key (.cer, .crt, .spc, .key) -> Give a name and identity
Read more: saurabs
QR:
Push the Turbo button
Posted by
jasper22
at
11:41
|
תשתית Open Source להעברת מידע בשם ZeroMQ.
חלקכם אולי מכירים אותה אבל אני מניח שרובכם לא, אם אתם נמנים עם החלק השני של האנשים אז הפוסט הזה מיועד לכם.
ZeroMQ נכתבה ב-C תחת רשיון LGPL Open Source אולם נכתבו לה Wrappers עבור שפות רבות כגון C++, C#, F#, Java, Node.js, Objective-C, Perl, PHP, Python, Ruby ועוד.
ממבט ראשון היא נראית כמו ספריה המכילה יכולות תקשורת אבל בעצם משמשת כתשתית אסינכרונית להעברת מידע בין Threads ו-Process באמצעות שימוש ב-Queues. היא מאפשרת לכם להעביר הודעות עד גודל 1GBבמגוון שכבות תקשורת כגון In-Process, TCP, Multicast. ניתן לחבר socket בין N ל-N משתמשים באמצעות שימוש ב- Pub-Sub, fanout, task distribution ו-Requst-Reply. חשוב להדגיש שהתשתית מהירה מאוד ואסינכרונית מה שמאפשר ליצור אפליקציות שניתן לבצע להן Scale up בכמעט אפס עבודה.
שילוב של API אינטואיטיבי, יעילות, דינמיות וביצועים מדהימים הופכים את התשתית למאוד אטרקטיבית למי שמעוניין להעביר מידע בקצבים גבוהים ביותר עם זמני תגובה מהירים.
Publisher – Subscriber
מתחשק לכם לעבוד בתצורת Publisher-Subscriber? אין בעיה, בדוגמא הבאה תראו כמה זה פשוט.
Read more: Freedom Of Speach
Read more: ZeroMQ
QR:
Запуск Windows 95/98/XP на ARM устройствах на базе Android
Posted by
jasper22
at
10:05
|
Не многие знают о том, что на сегоднящний день существует несколько способов запустить полноценную ОС Windows, на ARM планшете или смартфоне, работающем на платформе Android. Зачастую, такая возможность может понадобиться не только для того чтобы удивить друзей и знакомых, но и для решения вполне серьезных задач. К примеру вам срочно требуется воспользоваться програмой, которая работает только в Windows, в пути, например в тесном метро (не будете же вы там пользоваться 15” ноутбуком). Также способы описанные в статье позволяют стабильно играть в практически любые DOS игры и некоторые для Windows (Fallout к примеру).
Планшеты на базе Windows стоят недешево, а планшет на базе Android, позволяющий нормально работать с запущенной на нем Windows сегодня можно купить дешевле чем за 100$. В этой статье я хочу рассказать о нескольких способах получения работоспособной Windows на Android планшете, а в качестве подопытного мы будем использовать дешевый китайский планшет с 1Ггц процессором и 1Гб ОЗУ.
Read more: Habrahabr.ru
QR:
WorkSmart Guides - Updated ready-made IT user documentation
Posted by
jasper22
at
09:52
|
When I started working at Microsoft, I hadn’t been in such an open, technology rich culture before. And with so many IT systems around, and so many different software resources, my head was buzzing. In fact, I remember that at the end of the first week, the number of links in my Favourites was massive – just to internal websites.
I’d never used internet telephony, encryption, instant messaging, live meeting or SharePoint before, so I was all at sea until I could play around and work out how they were supposed to operate. Meanwhile, people who’d been at Microsoft for a while were metaphorically whizzing past me, as they collaborated, shared, published and distributed information. Whilst I was trying to work out how to answer my desk phone.
One of the godsends for me was a set of documents called Work Smart Guides, which walked me through the basics of some of the new technology I was encountering.
As our IT team describe it, Work Smart Guides bridge the gap between technology and users. Work Smart guides provide employees with scenario-based, best-use productivity aids on Microsoft products and technologies.
We produce them because we expect to see more consistent, productive, and cost-effective use of products and technologies across the company – which helps the business ROI on IT investments, as well as helping people to understand the benefit the IT team deliver to users.
Updated ready-made IT guides
The Microsoft IT Team have just updated the published versions that you could modify and publish for your users. This is a great step – I’m guessing that lots of schools, TAFEs and Universities are either producing user documentation for staff, or want to. And I bet that 80-90% of the content is identical in each institution. So these guides would make a good starter for 10, either for the format, or the instructions, or simply the screenshots. As an example, here’s the Email Basics one.
Read more: The Education Blog
QR:
Metro app development hidden gem: anonymous type binding
Posted by
jasper22
at
09:47
|
Just a little post to point out a hidden gem if you are a .NET developer creating a Metro style app: you can bind to anonymous types. This came up in a discussion with a customer today that I was having and, frankly, I never tried it until then because my mind was back in Silverlight where this isn’t possible. There may not be a tone of cases where this is valuable for you, but knowing it is there may help.
Let’s assume I have a basic class Person:
1: public class Person
2: {
3: public int Age { get; set; }
4: public string FirstName { get; set; }
5: public string Gender { get; set; }
6: }
And in my application I have a list of that Person type that I somehow received. In this example, I’m just hard-coding it right now.
1: List<Person> people = new List<Person>();
2: people.Add(new Person() { Age = 38, FirstName = "Tim", Gender = "Male" });
3: people.Add(new Person() { Age = 9, FirstName = "Zoe", Gender = "Female" });
4: people.Add(new Person() { Age = 5, FirstName = "Zane", Gender = "Male" });
I can then decide I want to bind to a ListView control which has a particular template:
1: <ListView x:Name="PeopleList" Width="500" Height="300">
2: <ListView.ItemTemplate>
3: <DataTemplate>
4: <StackPanel Orientation="Horizontal">
5: <TextBlock Text="{Binding TheName}" Margin="0,0,10,0" />
6: <TextBlock Text="{Binding GuysAge}" />
7: </StackPanel>
8: </DataTemplate>
9: </ListView.ItemTemplate>
10: </ListView>
Notice that I’m binding to properties (TheName and GuysAge) that don’t exist on my Person class? In my code, I can then create a LINQ query to filter out only the “dudes” from my list and bind that result:
Read more: Tim
QR:
Creation of Application Pool on IIS
Note: Add Microsoft.Web.Management.dll as reference(This can be found Windows/system32/inetsrv folder)
1) Create a class structure to take input parameters for Creation of Application Pool
/// <summary>
/// This class just provides parameters for application pool creation.
/// </summary>
public class ApplicationPoolParams
{
public ApplicationPoolParams(string appPoolName,
string metabasePath,uint queueLength,string managedRuntimeVersion,ManagedPipelineMode managedPipeLineMode,ProcessModelAppPool processModel,RecyclingAppPool recycleAppPool,CpuAppPool cpuAppPool)
{
Name = appPoolName;MetabasePath = metabasePath;QueueLength = queueLength;ManagedRuntimeVersion = managedRuntimeVersion;PipelineMode = managedPipeLineMode;ProcessModelData = processModel;RecycleAppPoolData = recycleAppPool;CpuData = cpuAppPool;
}public string Name { get; set; }public string MetabasePath { get; set; }public uint QueueLength { get; set; }public string ManagedRuntimeVersion { get; set; }public ManagedPipelineMode PipelineMode { get; set; }public ProcessModelAppPool ProcessModelData { get; set;}public RecyclingAppPool RecycleAppPoolData { get; set; }public CpuAppPool CpuData { get; set; }}public class ProcessModelAppPool{
public ProcessModelAppPool(TimeSpan idleTimeOut,uint maxProcesses){IdleTimeout = idleTimeOut;MaxProcesses = maxProcesses;}
public TimeSpan IdleTimeout { get; set; }public uint MaxProcesses { get; set; }
}public class RecyclingAppPool{
public RecyclingAppPool(bool isOverlappingRotation,bool isRotationOnConfigChange, PeriodicRestartAppPool periodic){
DisallowOverlappingRotation = isOverlappingRotation;DisallowRotationOnConfigChange = isRotationOnConfigChange;
Read more: s.ghosh
QR:
Miguel de Icaza on ASP.NET MVC, Moonlight, and the Android Lawsuit
Posted by
jasper22
at
12:14
|
We had a chance to catch-up with Miguel de Icaza, founder of the Mono project and it’s new parent company, Xamarin. Some of the topics we covered include the future of ASP.NET MVC on Mono and the end of the Moonlight project.
InfoQ: Mono has supported ASP.NET since the early days. Do you see it as just a checkbox feature or is there a lot of interest in ASP.NET on the Mono platform?
Miguel de Icaza: We have not done a survey in a while, but on the last survey that we ran, ASP.NET on Unix was still a feature that people cared about. I would say that the interest declined when Microsoft fixed their licensing for Windows Servers, so the financial appeal of Mono was reduced in those cases. Nowadays, the main driver is to run ASP.NET when the rest of the stack is mostly centered around Linux.
InfoQ: ASP.NET MVC has been open source for a while now. In the past, how much effort was needed to make it compatible with Mono?
Miguel: It was very easy to get MVC 1 and MVC 2 running with Mono. With MVC3 things changed, since MVC3 was open source, but took a few dependencies on libraries that were not open source at the time, or were transitional libraries. So supporting MVC3 was easy, but deploying it was. It was a very rare to see an MVC3 site deployed with Mono, it was just too difficult.
With the recent opening up of the Microsoft ASP.NET libraries this has changed, and we managed to make MVC3 work out of the box with Mono.
Finally, for MVC4, we won’t be able to run this for a while, since MVC4 requires us to upgrade the core ASP.NET engine to support the new async pipeline and currently nobody is working on it. It will be a matter of whether people care enough to contribute those changes to Mono and make this run.
InfoQ: Do you see the ability to contribute directly to ASP.NET MVC as a significant advantage for maintaining compatibility?
The main benefit of the open sourcing of ASP.NET MVC is for its own community: for too long innovation, bug fixing an extensions has been limited to what the developers at Microsoft did, could do, or were able to specify. This will bring ASP.NET in line with other open source frameworks that evolved quickly and responded quickly to change.
InfoQ: Right now, there are four different XAML-based UI technologies: WPF, Silverlight, Silverlight for Windows Embedded and Silverlight for Windows Phone. With the introduction of Windows 8, we will be seeing a fifth version? What is your opinion of this diversification?
Miguel: We are currently focused on C# for Android, iOS and Mac so we do not tend to interact much with XAML based frameworks.
There are interesting parts to XAML, but I was never completely bought into XML for the markup. I wished for a very long time that they had adopted something simpler for humans to produce, like using Json for the markup, or the markup that was part of JavaFX. It was just as easy to consume and maintain with tools, but it was also easier on the eye for programmers and easier to type.
At one point we implemented an open source rendering engine that was capable of rendering Silverlight 3/4 markup.
Read more: InfoQ
QR:
Windows Explorer Preview Pane for .vb files
Posted by
jasper22
at
10:32
|
I love using the Preview Pane in Windows Explorer to quickly preview file contents:
Usually, to enable this preview for a file extension I just open regedit, go to HKEY_CLASSES_ROOT –> .xxx (where xxx is the extension you’re interested in), and add a string key called PerceivedType with value of “text”: http://blog.wpfwonderland.com/2011/01/15/customize-windows-7-preview-pane-for-xaml-files/
However for some reason it didn’t work for .vb files. After some web searching, one solution I found that worked for me is to add the preview handler GUID explicitly under a “shellex” key: http://www.howtogeek.com/howto/windows-vista/make-windows-vista-explorer-preview-pane-work-for-more-file-types/
Read more: Kirill Osenkov
QR:
TaskCancelledException vs OperationCancelledException
I had a conversation with Stephen Toub, Peter Ritchie and Kevin Hazzard about the different between the TaskCancelledException and the OperationCancelledException. It turns out not to be a big difference, but some understanding might keep you out of a bit of trouble.
TaskCancelledException derives from OperationCancelledException. TaskCancelledException contains a property for the cancelled task.
If you’re catching exceptions, you probably want to catch both exceptions. If you don’t care about the task, you can do this by just catching the OperationCancelledException since the TaskCancelledException derives from it. Or you can catch them both in order if you use the task in your exception response. Catching only the TaskCancelledException will not work in all cases, since it won’t catch OperationCancelledException.
If you’re throwing an exception, and there’s a task available, throw TaskCanceledException. If there isn’t a task available, throw an OperationCancelledException. This is reflected in the framework when the CancellationToken’s ThrowIfCancellationRequested method throws an OperationCancelledException.
If you’re manually throwing cancellation exceptions, check that you aren’t repeating things already handled well by the .NET framework. CancellationTokenSource and CancellationToken may take a little getting used to, but this mechanism provides a predictable approach that handles some tricky threading side cases that will ultimately make your code simpler and easier to understand.
Read more: Leaning Into Windows
QR:
Microsoft Posts Windows 8 App Porting Guides
Posted by
jasper22
at
17:46
|
A Microsoft developer evangelist has posted links to a series of Microsoft guides for porting existing mobile apps from other platforms, including the iPad, to Windows 8. These guides should be interesting to any developer thinking about, or examining, Microsoft’s platform of the future.
“Developers are excited about Metro app development, but say that the hardest part is coming up with an app idea,” Microsoft’s Jennifer Marsman writes in her MSDN blog. “Some folks want to walk through converting an existing app to Metro as a learning exercise. There are other folks who have very successful websites or apps that they would like to make available on Windows 8 too.”
Marsman offers up the following resources:
Design-focused articles
Porting an iPad app to a Metro app – Focused on design, this article explains how to transition between the iPad and Metro user experiences.
Rethinking a web site as a Metro app – This article is also focused on design, but shows the process of redesigning a web site as a Metro app.
Porting a web site
Migrating a web app to Metro app – This one is focused on the development and conversion of a web app to a Metro app using HTML and JavaScript.
Migrating a web site to Metro app – Another short article, this one discusses issues you’ll run into around communication, streaming, security, client package deployment, data sharing, and syndication while migrating a web site to Metro.
Porting a Windows Phone app
Migrating a Windows Phone 7 app to XAML Metro app – This article examines how one can port a Silverlight Windows Phone 7 app to a Metro app that is written with XAML. It discusses the differences between the WP7/Silverlight and Windows RT namespaces and provides a useful list of the differences in the UI capabilities of each.
Migrating a Windows Phone 7 app to JavaScript Metro app – This article examines porting a Windows Silverlight-based Phone 7 app to a Metro app that is written in HTML and JavaScript.
Read more: Paul Thurrots
QR:
Client-Side Logging in Silverlight
Posted by
jasper22
at
12:04
|
Many of us have implemented logging in our ASP.NET, Windows Forms and WPF applications, so why shouldn’t you do the same in your Silverlight applications? Well, you should. In this blog post I will show you one approach on how you might perform this logging. The class I will use is called PDSALoggingManager. This class has a method named Log() you use to publish data into a log file in your Silverlight application. A method named LogException() is also available for logging information about any exceptions that happen on the client-side of your Silverlight application. Let’s take a look at the usage of the PDSALoggingManager class.
Logging Data
The simplest way to log information using the PDSALoggingManager class is to call the Log() method with some string data as shown below:
PDSALoggingManager.Instance.Log("Some data to log");
This will add the string passed to the Log() method to an internal StringBuilder object that contains the log information followed by a NewLine character. The Log() method also writes the string to a file located in isolated storage. What is written for each piece of data passed to the Log() method is shown here:
'Informational' log entry written on 5/22/2012 5:51:48 AM, from class: 'SL_Log.MainPage'
Some Data To Log
If you set the LogSystemInfo property on the PDSALoggingManager class prior to calling Log(), then system information is written to the log at the same time as the log data. Below is a sample of the log data with the system information appended to the end.
---------------------------------------------------------
'Informational' log entry written on 5/22/2012 5:51:48 AM, from class: 'SL_Log.MainPage'
Some Data To Log
System Information
DateTime=5/22/2012 5:51:48 AM
Current URL=file:///D:/MyStuff/BlogEntries/2012/
Samples/SL-Log/SL-Log/Bin/Debug/SL_LogTestPage.html
OSVersion=Microsoft Windows NT 6.1.7601 Service Pack 1
OSName=Windows 7
CurrentAssemblyName=PDSA.Silverlight, Version=5.0.0.0,
Culture=neutral, PublicKeyToken=null
MainAssemblyName=SL-Log, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null
AppDomainName=Silverlight AppDomain
UserLanguage=en-US
CompanyName=PDSA, Inc.
ProductName=Silverlight Logging
Description=Silverlight Logging
Title=Silverlight Logging
Copyright=Copyright © 2012 by PDSA, Inc.
ApplicationVersion=1.0.0.0
Stack Trace={LogInfoSample,btnLogInfo_Click}
-----------------------------------------------------------
The system information added to the end of the log comes from another class called PDSASystemInfo. Note that I blogged about this class earlier, so check out my previous blog entry at http://weblogs.asp.net/psheriff/archive/2012/05/20/retrieve-system-information-in-silverlight.aspx for information on this class and how that data was gathered.
Passing Extra Data to Log
You have an additional overload on the Log() method that takes a generic Dictionary<string, string> object you load with key/value pairs of data. Call this version of Log() like the following:
Dictionary<string, string> extra =
new Dictionary<string, string>();
extra.Add("CustomerId", "1");
extra.Add("StateCode", "CA");
PDSALoggingManager.Instance.Log("Some data to log", extra);
Read more: Paul Sheriff's Blog for the Real World
QR:
Мгновенный поиск файлов в Windows. Ловкость рук и никакого мошенничества
Posted by
jasper22
at
11:38
|
Если в Windows XP поиск файлов был хоть и медленным, но все-таки работоспособным, то в Windows 7 он превратился во что-то совсем непонятное. Многие успешно пользуются поиском в Far'е или Total Commander'е вместо стандартных средств Windows. Когда на дисках очень много файлов, такой поиск также выполняется медленно. Я бы вряд ли поверил, если бы не попробовал сам, что файлы можно находить мгновенно (!), прямо во время ввода имени файла в строку поиска. Заинтересовались?
Чудо-программа, которая сэкономила мне массу времени и продолжает выручать каждый день, называется Everything. Это бесплатное мини-приложение (размер portable-версии — 272 КБ) делает всего одну простую вещь — оно ищет файлы на дисках по части имени файла. Магия в том, что поиск происходит мгновенно, по мере ввода букв имени файла в строку поиска (как при «живом поиске» Google). Это открывает гораздо бОльшие возможности поиска файлов. Например, если вы забыли точное название файла, вы можете быстро попробовать ввести разные варианты названия. При «классическом» поиске вам пришлось бы каждый раз раз долго ждать завершения поиска, а здесь сразу видно, нашлось что-то или нет:
Read more: Habrahabr.ru
Read more: Everything
QR:
Вышел бесплатный профессиональный видеоредактор Lightworks
Posted by
jasper22
at
10:46
|
“Бэтмен навсегда”, “Остров проклятых”, “Отступники”, “Король говорит”, “Авиатор”, “Карты, деньги, два ствола”, “Криминальное чтиво” — это далеко не полный список фильмов, смонтированных с помощью Lightworks за его более чем двадцатилетнюю историю. С 1989 года Lightworks сменил несколько владельцев, пока в 2009 его не приобрела компания EditShare — производитель систем хранения видео для ТВ и киностудий. Новые хозяева решили порвать с традицией продавать подобный софт за тысячи долларов, и теперь профессиональная версия Lightworks стоит 60$, а базовая — бесплатна. Причём эта “базовая” версия мало чем отличается от платной и не уступит многим профессиональным версиям других редакторов. Но и это ещё не всё — EditShare собирается в ближайшем будущем выпустить версии для Linux и Mac (именно в таком порядке) и открыть исходники.
Read more: Habrahabr.ru
Read more: Lightworks for Windows v11.0.0
QR:
Moving Config Sections to External Files
An App.config file or a Web.config file are great places to store configurable information – information that generally doesn’t change; but we want to be able to change easily (i.e., without rebuilding and redeploying the application.) Examples include connection strings (stored in the config file’s <connectionStrings> section) and application-wide name-value pairs (stored in the config file’s <appSettings> section).
We can add more flexibility by moving a section to an external file and linking to that file from the config file.
By splitting the file, we can manage and deploy only those settings separate from the rest of the configuration.
To do so, we create a new text file and copy that section into that file; then use the configSource attribute of the section tag in the original config file to point to the new file.
For example, the following app.config contains all the application’s connection strings and application settings
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="MyApp_Dev" connectionString="Data Source=SQL071;Initial Catalog=Awesome_Dev;Integrated Security=True"/>
<add name="MyApp_QA" connectionString="Data Source=SQL071;Initial Catalog=Awesome_Dev;Integrated Security=True"/>
<add name="MyApp_Prod" connectionString="Data Source=SQL071;Initial Catalog=Awesome_Dev;Integrated Security=True"/>
</connectionStrings>
<appSettings>
<add key="CompanyName" value="The Awesome Company"/>
<add key="PhoneNumber" value="(513) 555-4444"/>
</appSettings>
</configuration>
...
...
Then, point to these files in the app.config, as shown below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings configSource="connections.config" />
<appSettings configSource="appSettings.config" />
</configuration>
One caveat to doing this: The configSource files (connections.config and appSettings.config in our example) must be in the same folder as the config file. We can accomplish this by selecting each configSource file in Solution Explorer and setting its Copy to Output directory property to either “Copy always” or “Copy if newer”.
QR:
Subscribe to:
Posts (Atom)