Skip to content

Commit 6e2d4cd

Browse files
committedDec 30, 2014
async support and guid primary key support
Add support for GUID primary keys (using default value of NewID()) Target .Net 4.0 and 4.5 and add async support
1 parent 73365d6 commit 6e2d4cd

27 files changed

+1345
-856
lines changed
 

‎.nuget/NuGet.exe

990 KB
Binary file not shown.

‎.nuget/NuGet.targets

+38-47
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5-
5+
66
<!-- Enable the restore command to run before builds -->
77
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
88

@@ -11,54 +11,65 @@
1111

1212
<!-- Determines if package restore consent is required to restore packages -->
1313
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14-
14+
1515
<!-- Download NuGet.exe if it does not already exist -->
1616
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
1717
</PropertyGroup>
18-
18+
1919
<ItemGroup Condition=" '$(PackageSources)' == '' ">
2020
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21-
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
2222
<!--
23-
<PackageSource Include="https://nuget.org/api/v2/" />
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
2424
<PackageSource Include="https://my-nuget-source/nuget/" />
2525
-->
2626
</ItemGroup>
2727

2828
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
2929
<!-- Windows specific commands -->
3030
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31-
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
32-
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
3331
</PropertyGroup>
34-
32+
3533
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
3634
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
3735
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
38-
<PackagesConfig>packages.config</PackagesConfig>
39-
<PackagesDir>$(SolutionDir)packages</PackagesDir>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
4046
</PropertyGroup>
4147

4248
<PropertyGroup>
4349
<!-- NuGet command -->
44-
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
4551
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
46-
52+
4753
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
48-
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
4955

5056
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
51-
57+
5258
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
60+
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
63+
5364
<!-- Commands -->
54-
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)"</RestoreCommand>
55-
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
5667

5768
<!-- We need to ensure packages are restored prior to assembly resolve -->
58-
<ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
69+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
5970
RestorePackages;
60-
$(ResolveReferencesDependsOn);
61-
</ResolveReferencesDependsOn>
71+
$(BuildDependsOn);
72+
</BuildDependsOn>
6273

6374
<!-- Make the build depend on restore packages -->
6475
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
@@ -70,37 +81,36 @@
7081
<Target Name="CheckPrerequisites">
7182
<!-- Raise an error if we're unable to locate nuget.exe -->
7283
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
73-
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
7484
<!--
7585
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
7686
This effectively acts as a lock that makes sure that the download operation will only happen once and all
7787
parallel builds will have to wait for it to complete.
7888
-->
79-
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
8090
</Target>
8191

8292
<Target Name="_DownloadNuGet">
8393
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
8494
</Target>
8595

86-
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
8797
<Exec Command="$(RestoreCommand)"
8898
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
89-
99+
90100
<Exec Command="$(RestoreCommand)"
91101
LogStandardErrorAsError="true"
92102
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
93103
</Target>
94104

95105
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
96-
<Exec Command="$(BuildCommand)"
106+
<Exec Command="$(BuildCommand)"
97107
Condition=" '$(OS)' != 'Windows_NT' " />
98-
108+
99109
<Exec Command="$(BuildCommand)"
100110
LogStandardErrorAsError="true"
101111
Condition=" '$(OS)' == 'Windows_NT' " />
102112
</Target>
103-
113+
104114
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
105115
<ParameterGroup>
106116
<OutputFilename ParameterType="System.String" Required="true" />
@@ -119,7 +129,7 @@
119129
120130
Log.LogMessage("Downloading latest version of NuGet.exe...");
121131
WebClient webClient = new WebClient();
122-
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
123133
124134
return true;
125135
}
@@ -131,23 +141,4 @@
131141
</Code>
132142
</Task>
133143
</UsingTask>
134-
135-
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
136-
<ParameterGroup>
137-
<EnvKey ParameterType="System.String" Required="true" />
138-
<EnvValue ParameterType="System.String" Required="true" />
139-
</ParameterGroup>
140-
<Task>
141-
<Using Namespace="System" />
142-
<Code Type="Fragment" Language="cs">
143-
<![CDATA[
144-
try {
145-
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
146-
}
147-
catch {
148-
}
149-
]]>
150-
</Code>
151-
</Task>
152-
</UsingTask>
153-
</Project>
144+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{A54F7AB7-F6DE-43AA-9B31-2065CC6F16D8}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Dapper.SimpleCRUD</RootNamespace>
11+
<AssemblyName>Dapper.SimpleCRUD</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
15+
<RestorePackages>true</RestorePackages>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<DocumentationFile>bin\Release\Dapper.SimpleCRUD.XML</DocumentationFile>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Dapper">
37+
<HintPath>..\packages\Dapper.1.38\lib\net45\Dapper.dll</HintPath>
38+
</Reference>
39+
<Reference Include="System" />
40+
<Reference Include="System.Core" />
41+
<Reference Include="System.Xml.Linq" />
42+
<Reference Include="System.Data.DataSetExtensions" />
43+
<Reference Include="Microsoft.CSharp" />
44+
<Reference Include="System.Data" />
45+
<Reference Include="System.Xml" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="..\Dapper.SimpleCRUD\Properties\AssemblyInfo.cs">
49+
<Link>Properties\AssemblyInfo.cs</Link>
50+
</Compile>
51+
<Compile Include="..\Dapper.SimpleCRUD\SimpleCRUD.cs">
52+
<Link>SimpleCRUD.cs</Link>
53+
</Compile>
54+
<Compile Include="SimpleCRUDAsync.cs" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<None Include="packages.config" />
58+
</ItemGroup>
59+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
61+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
62+
<PropertyGroup>
63+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
64+
</PropertyGroup>
65+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
66+
</Target>
67+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
68+
Other similar extension points exist, see Microsoft.Common.targets.
69+
<Target Name="BeforeBuild">
70+
</Target>
71+
<Target Name="AfterBuild">
72+
</Target>
73+
-->
74+
</Project>

0 commit comments

Comments
 (0)
Please sign in to comment.