summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-05-17 22:35:41 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-05-17 22:35:41 -0700
commit75a1fa8ad5d62e3a8241a2e796c903099c130020 (patch)
tree61cf73657a8e0bea51cb65f06344daf8cf2d31ba
parent18c5c8fd2a715086674654e461608fa6fc33ba1a (diff)
parente2e3ae8f341dd75d4ffe6c1363f69ab92eac7081 (diff)
downloadDotNetOpenAuth-75a1fa8ad5d62e3a8241a2e796c903099c130020.zip
DotNetOpenAuth-75a1fa8ad5d62e3a8241a2e796c903099c130020.tar.gz
DotNetOpenAuth-75a1fa8ad5d62e3a8241a2e796c903099c130020.tar.bz2
Merge branch 'v3.4' into oauthWRAP
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Web.config8
-rw-r--r--samples/OAuthConsumer/GoogleAddressBook.aspx.cs4
-rw-r--r--samples/OAuthConsumer/SampleWcf.aspx.cs16
-rw-r--r--samples/OAuthConsumer/SignInWithTwitter.aspx.cs6
-rw-r--r--samples/OAuthConsumer/Twitter.aspx.cs16
-rw-r--r--samples/OAuthConsumerWpf/App.config2
-rw-r--r--samples/OAuthConsumerWpf/MainWindow.xaml.cs2
-rw-r--r--samples/OAuthServiceProvider/Default.aspx.cs2
-rw-r--r--samples/OAuthServiceProvider/Members/Authorize.aspx.cs12
-rw-r--r--samples/OpenIdProviderMvc/Views/Web.config4
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs7
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs19
-rw-r--r--src/DotNetOpenAuth/Messaging/MessagingUtilities.cs5
-rw-r--r--src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs24
-rw-r--r--tools/DotNetOpenAuth.props6
-rw-r--r--tools/DotNetOpenAuth.targets4
16 files changed, 91 insertions, 46 deletions
diff --git a/projecttemplates/MvcRelyingParty/Views/Web.config b/projecttemplates/MvcRelyingParty/Views/Web.config
index df858d4..b744fc8 100644
--- a/projecttemplates/MvcRelyingParty/Views/Web.config
+++ b/projecttemplates/MvcRelyingParty/Views/Web.config
@@ -15,11 +15,11 @@
-->
<pages
validateRequest="false"
- pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
- pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
- userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
- <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
+ <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
diff --git a/samples/OAuthConsumer/GoogleAddressBook.aspx.cs b/samples/OAuthConsumer/GoogleAddressBook.aspx.cs
index 825dd1a..808065f 100644
--- a/samples/OAuthConsumer/GoogleAddressBook.aspx.cs
+++ b/samples/OAuthConsumer/GoogleAddressBook.aspx.cs
@@ -37,7 +37,7 @@
protected void Page_Load(object sender, EventArgs e) {
if (this.TokenManager != null) {
- MultiView1.ActiveViewIndex = 1;
+ this.MultiView1.ActiveViewIndex = 1;
if (!IsPostBack) {
var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
@@ -69,7 +69,7 @@
HttpUtility.HtmlEncode(contact.Email));
}
tableBuilder.Append("</table>");
- resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
+ this.resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
}
}
} \ No newline at end of file
diff --git a/samples/OAuthConsumer/SampleWcf.aspx.cs b/samples/OAuthConsumer/SampleWcf.aspx.cs
index 4055c6c..489e294 100644
--- a/samples/OAuthConsumer/SampleWcf.aspx.cs
+++ b/samples/OAuthConsumer/SampleWcf.aspx.cs
@@ -26,7 +26,7 @@
var accessTokenMessage = consumer.ProcessUserAuthorization();
if (accessTokenMessage != null) {
Session["WcfAccessToken"] = accessTokenMessage.AccessToken;
- authorizationLabel.Text = "Authorized! Access token: " + accessTokenMessage.AccessToken;
+ this.authorizationLabel.Text = "Authorized! Access token: " + accessTokenMessage.AccessToken;
}
}
}
@@ -36,7 +36,7 @@
WebConsumer consumer = this.CreateConsumer();
UriBuilder callback = new UriBuilder(Request.Url);
callback.Query = null;
- string[] scopes = (from item in scopeList.Items.OfType<ListItem>()
+ string[] scopes = (from item in this.scopeList.Items.OfType<ListItem>()
where item.Selected
select item.Value).ToArray();
string scope = string.Join("|", scopes);
@@ -49,27 +49,27 @@
protected void getNameButton_Click(object sender, EventArgs e) {
try {
- nameLabel.Text = CallService(client => client.GetName());
+ this.nameLabel.Text = CallService(client => client.GetName());
} catch (SecurityAccessDeniedException) {
- nameLabel.Text = "Access denied!";
+ this.nameLabel.Text = "Access denied!";
}
}
protected void getAgeButton_Click(object sender, EventArgs e) {
try {
int? age = CallService(client => client.GetAge());
- ageLabel.Text = age.HasValue ? age.Value.ToString(CultureInfo.CurrentCulture) : "not available";
+ this.ageLabel.Text = age.HasValue ? age.Value.ToString(CultureInfo.CurrentCulture) : "not available";
} catch (SecurityAccessDeniedException) {
- ageLabel.Text = "Access denied!";
+ this.ageLabel.Text = "Access denied!";
}
}
protected void getFavoriteSites_Click(object sender, EventArgs e) {
try {
string[] favoriteSites = CallService(client => client.GetFavoriteSites());
- favoriteSitesLabel.Text = string.Join(", ", favoriteSites);
+ this.favoriteSitesLabel.Text = string.Join(", ", favoriteSites);
} catch (SecurityAccessDeniedException) {
- favoriteSitesLabel.Text = "Access denied!";
+ this.favoriteSitesLabel.Text = "Access denied!";
}
}
diff --git a/samples/OAuthConsumer/SignInWithTwitter.aspx.cs b/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
index 9cea1f5..5bc46ef 100644
--- a/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
+++ b/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
@@ -15,14 +15,14 @@
public partial class SignInWithTwitter : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (TwitterConsumer.IsTwitterConsumerConfigured) {
- MultiView1.ActiveViewIndex = 1;
+ this.MultiView1.ActiveViewIndex = 1;
if (!IsPostBack) {
string screenName;
int userId;
if (TwitterConsumer.TryFinishSignInWithTwitter(out screenName, out userId)) {
- loggedInPanel.Visible = true;
- loggedInName.Text = screenName;
+ this.loggedInPanel.Visible = true;
+ this.loggedInName.Text = screenName;
// In a real app, the Twitter username would likely be used
// to log the user into the application.
diff --git a/samples/OAuthConsumer/Twitter.aspx.cs b/samples/OAuthConsumer/Twitter.aspx.cs
index 44350ca..8288ed0 100644
--- a/samples/OAuthConsumer/Twitter.aspx.cs
+++ b/samples/OAuthConsumer/Twitter.aspx.cs
@@ -36,7 +36,7 @@
protected void Page_Load(object sender, EventArgs e) {
if (this.TokenManager != null) {
- MultiView1.ActiveViewIndex = 1;
+ this.MultiView1.ActiveViewIndex = 1;
if (!IsPostBack) {
var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
@@ -74,13 +74,13 @@
HttpUtility.HtmlEncode(update.Status));
}
tableBuilder.Append("</table>");
- resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
+ this.resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
}
protected void uploadProfilePhotoButton_Click(object sender, EventArgs e) {
- if (profilePhoto.PostedFile.ContentType == null) {
- photoUploadedLabel.Visible = true;
- photoUploadedLabel.Text = "Select a file first.";
+ if (this.profilePhoto.PostedFile.ContentType == null) {
+ this.photoUploadedLabel.Visible = true;
+ this.photoUploadedLabel.Text = "Select a file first.";
return;
}
@@ -88,9 +88,9 @@
XDocument imageResult = TwitterConsumer.UpdateProfileImage(
twitter,
this.AccessToken,
- profilePhoto.PostedFile.InputStream,
- profilePhoto.PostedFile.ContentType);
- photoUploadedLabel.Visible = true;
+ this.profilePhoto.PostedFile.InputStream,
+ this.profilePhoto.PostedFile.ContentType);
+ this.photoUploadedLabel.Visible = true;
}
}
} \ No newline at end of file
diff --git a/samples/OAuthConsumerWpf/App.config b/samples/OAuthConsumerWpf/App.config
index d4d434a..dab6eed 100644
--- a/samples/OAuthConsumerWpf/App.config
+++ b/samples/OAuthConsumerWpf/App.config
@@ -89,7 +89,7 @@
</wsHttpBinding>
</bindings>
<client>
- <endpoint address="http://localhost:65169/OAuthServiceProvider/DataApi.svc"
+ <endpoint address="http://localhost:65169/DataApi.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDataApi"
contract="WcfSampleService.IDataApi" name="WSHttpBinding_IDataApi">
<identity>
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
index 8c8d035..24d5249 100644
--- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs
+++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
@@ -66,7 +66,7 @@
this.wcfTokenManager.ConsumerKey = "sampleconsumer";
this.wcfTokenManager.ConsumerSecret = "samplesecret";
MessageReceivingEndpoint oauthEndpoint = new MessageReceivingEndpoint(
- new Uri("http://localhost:65169/OAuthServiceProvider/OAuth.ashx"),
+ new Uri("http://localhost:65169/OAuth.ashx"),
HttpDeliveryMethods.PostRequest);
this.wcf = new DesktopConsumer(
new ServiceProviderDescription {
diff --git a/samples/OAuthServiceProvider/Default.aspx.cs b/samples/OAuthServiceProvider/Default.aspx.cs
index 66adc82..653046a 100644
--- a/samples/OAuthServiceProvider/Default.aspx.cs
+++ b/samples/OAuthServiceProvider/Default.aspx.cs
@@ -38,7 +38,7 @@
});
dc.SubmitChanges();
- databaseStatus.Visible = true;
+ this.databaseStatus.Visible = true;
} catch (System.Data.SqlClient.SqlException ex) {
foreach (System.Data.SqlClient.SqlError error in ex.Errors) {
Response.Write(error.Message);
diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs
index ec98ddf..74b44c5 100644
--- a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs
+++ b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs
@@ -38,15 +38,15 @@
byte[] randomData = new byte[8];
CryptoRandomDataGenerator.GetBytes(randomData);
this.AuthorizationSecret = Convert.ToBase64String(randomData);
- OAuthAuthorizationSecToken.Value = this.AuthorizationSecret;
+ this.OAuthAuthorizationSecToken.Value = this.AuthorizationSecret;
- OAuth10ConsumerWarning.Visible = Global.PendingOAuthAuthorization.IsUnsafeRequest;
+ this.OAuth10ConsumerWarning.Visible = Global.PendingOAuthAuthorization.IsUnsafeRequest;
}
}
}
protected void allowAccessButton_Click(object sender, EventArgs e) {
- if (this.AuthorizationSecret != OAuthAuthorizationSecToken.Value) {
+ if (this.AuthorizationSecret != this.OAuthAuthorizationSecToken.Value) {
throw new ArgumentException(); // probably someone trying to hack in.
}
this.AuthorizationSecret = null; // clear one time use secret
@@ -60,10 +60,10 @@
sp.Channel.Send(response);
} else {
if (pending.IsUnsafeRequest) {
- verifierMultiView.ActiveViewIndex = 1;
+ this.verifierMultiView.ActiveViewIndex = 1;
} else {
string verifier = ServiceProvider.CreateVerificationCode(VerificationCodeFormat.AlphaNumericNoLookAlikes, 10);
- verificationCodeLabel.Text = verifier;
+ this.verificationCodeLabel.Text = verifier;
ITokenContainingMessage requestTokenMessage = pending;
var requestToken = Global.TokenManager.GetRequestToken(requestTokenMessage.Token);
requestToken.VerificationCode = verifier;
@@ -74,7 +74,7 @@
protected void denyAccessButton_Click(object sender, EventArgs e) {
// erase the request token.
- multiView.ActiveViewIndex = 2;
+ this.multiView.ActiveViewIndex = 2;
}
}
} \ No newline at end of file
diff --git a/samples/OpenIdProviderMvc/Views/Web.config b/samples/OpenIdProviderMvc/Views/Web.config
index 95bc467..df0103b 100644
--- a/samples/OpenIdProviderMvc/Views/Web.config
+++ b/samples/OpenIdProviderMvc/Views/Web.config
@@ -12,9 +12,9 @@
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
- <pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<controls>
- <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
+ <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
diff --git a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs
index 524f440..66237e7 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs
@@ -28,7 +28,12 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
[TestCase]
public void OptionalNullableStruct() {
- this.ParameterizedMessageTypeTest(typeof(MessageWithNullableOptionalStruct));
+ var message = new MessageWithNullableOptionalStruct();
+ var part = this.ParameterizedMessageTypeTest(message.GetType());
+
+ Assert.IsNull(part.GetValue(message));
+ part.SetValue(message, "3");
+ Assert.AreEqual("3", part.GetValue(message));
}
[TestCase]
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs
index c216a4d..389fa5d 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs
@@ -14,10 +14,27 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.UI {
public class UIRequestTests : OpenIdTestBase {
[TestCase]
public void Defaults() {
- UIRequest request = new UIRequest();
+ var request = new UIRequest();
Assert.AreEqual("popup", request.Mode);
Assert.AreEqual(1, request.LanguagePreference.Length);
Assert.AreEqual(CultureInfo.CurrentUICulture, request.LanguagePreference[0]);
+ Assert.IsFalse(request.Icon.HasValue);
+ }
+
+ [TestCase]
+ public void IconEncodingDecoding()
+ {
+ var request = new UIRequest();
+ MessageDictionary dictionary = this.MessageDescriptions.GetAccessor(request);
+ Assert.IsFalse(dictionary.ContainsKey("icon"));
+
+ Assert.IsFalse(request.Icon.HasValue);
+ dictionary["icon"] = "true";
+ Assert.IsTrue(request.Icon.Value);
+
+ dictionary.ClearValues();
+ request.Icon = true;
+ Assert.AreEqual("true", dictionary["icon"]);
}
[TestCase]
diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs
index 1a513ee..40a0791 100644
--- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs
@@ -804,7 +804,10 @@ namespace DotNetOpenAuth.Messaging {
if (throwOnNullKey) {
throw new ArgumentException(MessagingStrings.UnexpectedNullKey);
} else {
- Logger.OpenId.WarnFormat("Null key with value {0} encountered while translating NameValueCollection to Dictionary.", nvc[key]);
+ // Only emit a warning if there was a non-empty value.
+ if (!string.IsNullOrEmpty(nvc[key])) {
+ Logger.OpenId.WarnFormat("Null key with value {0} encountered while translating NameValueCollection to Dictionary.", nvc[key]);
+ }
}
} else {
dictionary.Add(key, nvc[key]);
diff --git a/src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs b/src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs
index ae54c3a..4590c44 100644
--- a/src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs
+++ b/src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs
@@ -129,9 +129,25 @@ namespace DotNetOpenAuth.Messaging.Reflection {
Contract.Assume(this.memberDeclaredType != null); // CC missing PropertyInfo.PropertyType ensures result != null
if (attribute.Encoder == null) {
if (!converters.TryGetValue(this.memberDeclaredType, out this.converter)) {
- this.converter = new ValueMapping(
- obj => obj != null ? obj.ToString() : null,
- str => str != null ? Convert.ChangeType(str, this.memberDeclaredType, CultureInfo.InvariantCulture) : null);
+ if (this.memberDeclaredType.IsGenericType &&
+ this.memberDeclaredType.GetGenericTypeDefinition() == typeof(Nullable<>)) {
+ // It's a nullable type. Try again to look up an appropriate converter for the underlying type.
+ Type underlyingType = Nullable.GetUnderlyingType(this.memberDeclaredType);
+ ValueMapping underlyingMapping;
+ if (converters.TryGetValue(underlyingType, out underlyingMapping)) {
+ this.converter = new ValueMapping(
+ underlyingMapping.ValueToString,
+ str => str != null ? underlyingMapping.StringToValue(str) : null);
+ } else {
+ this.converter = new ValueMapping(
+ obj => obj != null ? obj.ToString() : null,
+ str => str != null ? Convert.ChangeType(str, underlyingType, CultureInfo.InvariantCulture) : null);
+ }
+ } else {
+ this.converter = new ValueMapping(
+ obj => obj != null ? obj.ToString() : null,
+ str => str != null ? Convert.ChangeType(str, this.memberDeclaredType, CultureInfo.InvariantCulture) : null);
+ }
}
} else {
this.converter = new ValueMapping(GetEncoder(attribute.Encoder));
@@ -252,7 +268,7 @@ namespace DotNetOpenAuth.Messaging.Reflection {
}
/// <summary>
- /// Adds a pair of type conversion functions to the static converstion map.
+ /// Adds a pair of type conversion functions to the static conversion map.
/// </summary>
/// <typeparam name="T">The custom type to convert to and from strings.</typeparam>
/// <param name="toString">The function to convert the custom type to a string.</param>
diff --git a/tools/DotNetOpenAuth.props b/tools/DotNetOpenAuth.props
index 9bc6c22..8bc59dd 100644
--- a/tools/DotNetOpenAuth.props
+++ b/tools/DotNetOpenAuth.props
@@ -26,8 +26,10 @@
<ILMergeOutputAssemblyDirectory>$(OutputPath)unified\</ILMergeOutputAssemblyDirectory>
<ILMergeOutputAssembly>$(ILMergeOutputAssemblyDirectory)$(ProductName).dll</ILMergeOutputAssembly>
- <!-- Always use our own toolset's copy of Code Contracts for reliably reproducible builds. -->
- <CodeContractsInstallDir>$(ProjectRoot)tools\Contracts\</CodeContractsInstallDir>
+ <!-- Always use our own toolset's copy of Code Contracts for reliably reproducible builds.
+ Suppress the installed code contracts from importing itself. -->
+ <DontImportCodeContracts>true</DontImportCodeContracts>
+ <ImportCodeContractsFromToolset>true</ImportCodeContractsFromToolset>
</PropertyGroup>
<ItemGroup>
diff --git a/tools/DotNetOpenAuth.targets b/tools/DotNetOpenAuth.targets
index ef93039..8081115 100644
--- a/tools/DotNetOpenAuth.targets
+++ b/tools/DotNetOpenAuth.targets
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <Import Condition="'$(CodeContractsImported)' != 'true' AND '$(DontImportCodeContracts)' != 'true'" Project="$(CodeContractsInstallDir)\MsBuild\v4.0\Microsoft.CodeContracts.targets"/>
<Import Project="DotNetOpenAuth.Versioning.targets" />
<Import Project="JavascriptPacker.targets" />
<UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="ILMerge"/>
@@ -16,6 +15,7 @@
</ItemDefinitionGroup>
<PropertyGroup>
+ <CodeContractsInstallDir>$(ProjectRoot)tools\Contracts\</CodeContractsInstallDir>
<DefineConstants Condition=" '$(SignAssembly)' == 'true' ">$(DefineConstants);StrongNameSigned</DefineConstants>
<DefineConstants Condition=" '$(ClrVersion)' == '4' ">$(DefineConstants);CLR4</DefineConstants>
<AssemblySearchPaths>$(AssemblySearchPaths);$(ProjectRoot)lib</AssemblySearchPaths>
@@ -119,4 +119,6 @@
<Output TaskParameter="TargetOutputs" ItemName="ResignedAssembliesOutputs"/>
</MSBuild>
</Target>
+
+ <Import Condition="'$(CodeContractsImported)' != 'true' AND ('$(DontImportCodeContracts)' != 'true' or '$(ImportCodeContractsFromToolset)' == 'true')" Project="$(CodeContractsInstallDir)\MsBuild\v4.0\Microsoft.CodeContracts.targets"/>
</Project>