Skip to content

Commit f13dcbd

Browse files
authored
Set SDK version correctly in README (#585)
* Update README.md * Set SDK version correctly in README * Fix README * Remove nuspec * Update pr-validation.yml * Remove separate pack task * Upload artifact after test run * always run artifact * Fix globbing pattern * Change none to content * Move the tools include to CopyBuildBinaries target * Cleanup
1 parent ed70c79 commit f13dcbd

File tree

6 files changed

+71
-62
lines changed

6 files changed

+71
-62
lines changed

.github/workflows/pr-validation.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ jobs:
3535
dotnet-version: ${{ matrix.dotnetVersion }}
3636
dotnet-quality: ga
3737
- run: dotnet build DacFx.sln
38-
- run: dotnet pack DacFx.sln --no-build
3938
- run: dotnet test DacFx.sln --no-build -f ${{ matrix.targetFramework }}

src/Directory.Build.targets

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project>
2+
<!-- Utility task to replace a search string with new text in the provided files -->
3+
<UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.Core.dll" >
4+
<ParameterGroup>
5+
<InputFilename ParameterType="System.String" Required="true" />
6+
<OutputFilename ParameterType="System.String" Required="true" />
7+
<MatchExpression ParameterType="System.String" Required="true" />
8+
<ReplacementText ParameterType="System.String" Required="true" />
9+
</ParameterGroup>
10+
<Task>
11+
<Using Namespace="System" />
12+
<Using Namespace="System.IO" />
13+
<Using Namespace="System.Text.RegularExpressions" />
14+
<Code Type="Fragment" Language="cs">
15+
<![CDATA[
16+
File.WriteAllText(
17+
OutputFilename,
18+
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
19+
);
20+
]]>
21+
</Code>
22+
</Task>
23+
</UsingTask>
24+
</Project>

src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,4 @@
7373
</ItemGroup>
7474
</Target>
7575

76-
<UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.Core.dll" >
77-
<ParameterGroup>
78-
<InputFilename ParameterType="System.String" Required="true" />
79-
<OutputFilename ParameterType="System.String" Required="true" />
80-
<MatchExpression ParameterType="System.String" Required="true" />
81-
<ReplacementText ParameterType="System.String" Required="true" />
82-
</ParameterGroup>
83-
<Task>
84-
<Using Namespace="System" />
85-
<Using Namespace="System.IO" />
86-
<Using Namespace="System.Text.RegularExpressions" />
87-
<Code Type="Fragment" Language="cs">
88-
<![CDATA[
89-
File.WriteAllText(
90-
OutputFilename,
91-
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
92-
);
93-
]]>
94-
</Code>
95-
</Task>
96-
</UsingTask>
97-
9876
</Project>

src/Microsoft.Build.Sql/Microsoft.Build.Sql.csproj

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,32 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
<NuspecFile>$(MSBuildThisFileDirectory)Microsoft.Build.Sql.nuspec</NuspecFile>
6-
<PackageType>MSBuildSDK</PackageType>
7-
<PackageReadmeFile>README.md</PackageReadmeFile>
8-
<PackageReleaseNotes>https://github.com/microsoft/DacFx/tree/main/release-notes/Microsoft.Build.Sql</PackageReleaseNotes>
95
<IncludeBuildOutput>false</IncludeBuildOutput>
106
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
7+
<SdkIntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)\$(MSBuildThisFileName)</SdkIntermediateOutputPath>
8+
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
9+
<NoWarn>$(NoWarn);NU5128</NoWarn>
1110

1211
<!-- Path where all the DLLs build depends on will be copied to -->
1312
<BuildBinariesPath>$(MSBuildThisFileDirectory)\tools\net8.0\</BuildBinariesPath>
13+
14+
<!-- NuGet Package Properties -->
15+
<Authors>Microsoft</Authors>
16+
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
17+
<Description>This package contains the SDK for building SQL Database Projects (.sqlproj) in .NET.</Description>
18+
<Owners>Microsoft</Owners>
19+
<PackageIcon>images\nuspecicon.png</PackageIcon>
20+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
21+
<PackageProjectUrl>https://github.com/microsoft/DacFx</PackageProjectUrl>
22+
<PackageReadmeFile>README.md</PackageReadmeFile>
23+
<PackageReleaseNotes>https://github.com/microsoft/DacFx/tree/main/release-notes/Microsoft.Build.Sql</PackageReleaseNotes>
24+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
25+
<PackageTags>dacfx sqlproj build sdk</PackageTags>
26+
<PackageType>MSBuildSDK</PackageType>
27+
<RepositoryBranch>main</RepositoryBranch>
28+
<RepositoryType>git</RepositoryType>
29+
<RepositoryUrl>https://github.com/microsoft/DacFx</RepositoryUrl>
30+
<Title>Microsoft SQL Database Project Build SDK</Title>
1431
</PropertyGroup>
1532

1633
<ItemGroup>
@@ -37,15 +54,37 @@
3754
<PackageFiles Include="$(PkgSystem_IO_Packaging)\lib\net8.0\System.IO.Packaging.dll" />
3855
</ItemGroup>
3956
<Copy SourceFiles="@(PackageFiles)" DestinationFolder="$(BuildBinariesPath)\%(PackageFiles.RecursiveDir)" />
57+
<ItemGroup>
58+
<Content Include="tools\**" Pack="true" PackagePath="tools\" />
59+
</ItemGroup>
60+
</Target>
61+
62+
<!-- Sets the SDK version correctly in the README -->
63+
<Target Name="SetSdkAssemblyVersion" BeforeTargets="GenerateNuspec;Build">
64+
<ItemGroup>
65+
<TemplateFiles Include="README.md" />
66+
</ItemGroup>
67+
<Copy SourceFiles="@(TemplateFiles)" DestinationFiles="$(SdkIntermediateOutputPath)/%(RecursiveDir)%(Filename)%(Extension)" />
68+
<ReplaceFileText
69+
InputFilename="$(SdkIntermediateOutputPath)/README.md"
70+
OutputFilename="$(SdkIntermediateOutputPath)/README.md"
71+
MatchExpression="###ASSEMBLY_VERSION###"
72+
ReplacementText="$(PackageVersion)" />
73+
<ItemGroup>
74+
<Content Remove="$(SdkIntermediateOutputPath)\README.md" />
75+
<Content Include="$(SdkIntermediateOutputPath)\README.md" Pack="true" PackagePath="\"/>
76+
</ItemGroup>
4077
</Target>
4178

4279
<Target Name="DeleteToolsFolder" AfterTargets="Clean">
4380
<RemoveDir Directories="$(MSBuildThisFileDirectory)\tools" />
4481
</Target>
4582

4683
<ItemGroup>
47-
<None Include="README.md" Pack="true" PackagePath="\"/>
48-
<None Remove="tools\**" />
84+
<Content Include="sdk\**" Pack="true" PackagePath="sdk\" />
85+
<Content Include="$(SdkIntermediateOutputPath)\README.md" Pack="true" PackagePath="\"/>
86+
<Content Include="..\..\LICENSE.txt" Pack="true" PackagePath="\" />
87+
<Content Include="..\..\images\nuspecicon.png" Pack="true" PackagePath="images\nuspecicon.png" />
4988
</ItemGroup>
5089

5190
</Project>

src/Microsoft.Build.Sql/Microsoft.Build.Sql.nuspec

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Microsoft.Build.Sql/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Microsoft.Build.Sql (Preview)
1+
# Microsoft.Build.Sql
22

33
![NuGet Version](https://img.shields.io/nuget/v/microsoft.build.sql)
44

@@ -47,7 +47,7 @@ Use the [Microsoft.Build.Sql.Templates](https://www.nuget.org/packages/Microsoft
4747

4848
Depending on the complexity of your project, the conversion to a Microsoft.Build.Sql project may be straightforward. Building the project before the process and retaining the `.dacpac` for comparison after the conversion is highly recommended. The primary step in the conversion is to add the SDK reference. Edit the .sqlproj file by adding
4949
```xml
50-
<Sdk Name="Microsoft.Build.Sql" Version="0.2.5-preview" />
50+
<Sdk Name="Microsoft.Build.Sql" Version="###ASSEMBLY_VERSION###" />
5151
```
5252
inside the `<Project>` tag.
5353

0 commit comments

Comments
 (0)