Issue 1811 - update designer build to use local EntityFramework package.

Also updated a few tests which were using obsolete methods and added a
convenience target for uninstalling the test host.
This commit is contained in:
lajones 2013-12-10 11:03:57 -08:00
Родитель 56d497aa4b
Коммит fcf7f22eb2
10 изменённых файлов: 125 добавлений и 31 удалений

Просмотреть файл

@ -46,14 +46,21 @@
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<NoCacheSwitch Condition=" $(RequireNoCache) == 'true' ">-NoCache</NoCacheSwitch>
<PreReleaseSwitch Condition=" $(IncludePreRelease) == 'true' ">-PreRelease</PreReleaseSwitch>
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT' AND '$(PackageRestoreOutputDir)' != ''">"$(PackageRestoreOutputDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' AND '$(PackageRestoreOutputDir)' != ''">"$(PackageRestoreOutputDir)"</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(PaddedSolutionDir)' == '' AND '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(PaddedSolutionDir)' == '' AND '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<InstallCommandOptions>$(NonInteractiveSwitch) $(RequireConsentSwitch) $(NoCacheSwitch) $(PreReleaseSwitch) -solutionDir $(PaddedSolutionDir)</InstallCommandOptions>
<LocalRestoreCommand>$(NuGetCommand) install $(LocalPackageId) -source "$(LocalPackageSource)" $(InstallCommandOptions)</LocalRestoreCommand>
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(InstallCommandOptions)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
@ -84,6 +91,13 @@
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestoreLocalPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(LocalRestoreCommand)" Condition="'$(OS)' != 'Windows_NT'" />
<Exec Command="$(LocalRestoreCommand)"
LogStandardErrorAsError="true" Condition="'$(OS)' == 'Windows_NT'" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

Просмотреть файл

@ -98,6 +98,9 @@
Projects="$(SolutionDir)\tools\EFTools.skipstrongnames.targets" />
</Target>
<Target Name="BuildFramework">
<MSBuild Projects="$(RepositoryRoot)EF.msbuild" Targets="Package" Properties="Configuration=Release" />
</Target>
<Target Name="BuildDesigner">
<MSBuild Targets="$(BuildTargets)"
@ -118,7 +121,7 @@
Properties="Configuration=$(Configuration);$(BuildProperties);BuildPackages=false" />
</Target>
<Target Name="Build" DependsOnTargets="CreateDirectories;CheckSkipStrongNames;RestorePackages;BuildDesigner;BuildTestHost;BuildInstaller" />
<Target Name="Build" DependsOnTargets="CreateDirectories;CheckSkipStrongNames;BuildFramework;RestorePackages;BuildDesigner;BuildTestHost;BuildInstaller" />
<Target Name="Rebuild">
<MSBuild Projects="$(MSBuildProjectFile)" Properties="BuildTargets=Rebuild;Configuration=$(Configuration)" Targets="Clean;Build" />
@ -135,6 +138,14 @@
Command='msiexec /qb /i $(SolutionDir)\bin\$(Configuration)\VsIdeTestHost.msi /L*v $(LogsDir)VsIdeTestHost.msi.log' />
</Target>
<Target Name="UninstallTestHost">
<PropertyGroup>
<TestHostUnistallGuid Condition=" '$(VisualStudioVersion)' == '11.0' ">{710EEA0D-C40D-4245-B3FA-C883AAD83A65}</TestHostUnistallGuid>
<TestHostUnistallGuid Condition=" '$(TestHostUnistallGuid)' == '' ">{D39AE4C3-21C4-40DE-9F35-53A83803F8DB}</TestHostUnistallGuid>
</PropertyGroup>
<Exec Command='msiexec /qb /x $(TestHostUnistallGuid) /L*v $(LogsDir)VsIdeTestHost.msi.uninstall.log' />
</Target>
<Target Name="Install" DependsOnTargets="Rebuild">
<Exec Command='msiexec /qb /i $(OutputPath)en\EFTools.msi SKIPENVIRONMENTSETUP="$(SkipEnvSetup)" /L*v $(LogsDir)EFTools.msi.log' />
</Target>

Просмотреть файл

@ -34,8 +34,8 @@ namespace Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine
"storeModelNamespace must not be null or empty string");
// update the EDMX - stop if any attempt to update fails
if (UpdateStorageModels(model.GetStoreModel(), storeModelNamespace, model.ProviderInfo, errors)
&& UpdateConceptualModels(model.GetConceptualModel(), entityModelNamespace))
if (UpdateStorageModels(model.StoreModel, storeModelNamespace, model.ProviderInfo, errors)
&& UpdateConceptualModels(model.ConceptualModel, entityModelNamespace))
{
UpdateMapping(model);
}

Просмотреть файл

@ -12,7 +12,6 @@
<OutputType>Package</OutputType>
<Name>EFToolsMsi</Name>
<SolutionDir Condition="$(SolutionDir) == ''">..\..\..\..\</SolutionDir>
<PackagesDir Condition="$(PackagesDir) == ''">$(SolutionDir)packages</PackagesDir>
<RestorePackages>true</RestorePackages>
<EmbedCab Condition="$(EmbedCab) == ''">no</EmbedCab>
<IncludeLocalizedArtifacts Condition="$(IncludeLocalizedArtifacts) == ''">false</IncludeLocalizedArtifacts>
@ -88,13 +87,39 @@
</Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets"
Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x')" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<PropertyGroup>
<BuildDependsOn>RestorePackages;ExtractNuspec;ReplaceEFToolsStrings;$(BuildDependsOn)</BuildDependsOn>
<!-- If NuGetOutputPath is set search for packages there, otherwise look in the default place they are output by the runtime build -->
<PackagesInputDir Condition=" '$(PackagesDir)' == '' AND '$(NuGetOutputPath)' != ''">$(NuGetOutputPath)</PackagesInputDir>
<PackagesInputDir Condition=" '$(PackagesDir)' == ''">$(RepositoryRoot)bin\Release\NuGet</PackagesInputDir>
<!-- override output dir for package restore (which will automatically append \packages to path) -->
<PackageRestoreOutputDir>$(PackagesInputDir)</PackageRestoreOutputDir>
<!-- Now align PackagesDir with PackageRestoreOutputDir so that the local framework and the EF5 framework end up in the same directory -->
<PackagesDir>$(PackagesInputDir)\packages</PackagesDir>
<BuildDependsOn>RestorePackages;RestoreLocalPackages;ExtractNuspecs;ReplaceEFToolsStrings;$(BuildDependsOn)</BuildDependsOn>
</PropertyGroup>
<Target Name="ExtractNuspec">
<ExtractNuspec PackagesConfigPath="$(PackagesConfig)" PackagesOutputPath="$(PackagesDir)" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Target Name="ExtractNuspecs">
<ItemGroup>
<ExtractNuspecPackages Include="$(PackagesDir)\**\EntityFramework*.nupkg" />
</ItemGroup>
<ExtractNuspecFromPackage NuGetPackageFilePath="%(ExtractNuspecPackages.Identity)" />
</Target>
<Target Name="RestoreLocalPackages">
<ItemGroup>
<LocalPackageNames Include="EntityFramework" />
<LocalPackageNames Include="EntityFramework.SqlServerCompact" />
</ItemGroup>
<MSBuild Projects="$(RepositoryRoot).nuget\NuGet.targets" Targets="RestoreLocalPackage"
Properties="$(BuildProperties);PackageRestoreOutputDir=$(PackagesInputDir);LocalPackageId=%(LocalPackageNames.Identity);LocalPackageSource=$(PackagesInputDir);RequireNoCache=true;IncludePreRelease=true" />
</Target>
<Target Name="ReplaceEFToolsStrings">
<RegexReplaceInFile InputFileName="Resources\EFToolsStrings.wxl.tokenized"
OutputFileName="Resources\EFToolsStrings.wxl"
@ -134,4 +159,9 @@
</ItemGroup>
<Copy Condition="'$(Configuration)' == 'Debug'" SourceFiles="@(EFDesignerSymbolFiles)" DestinationFolder="$(OutputPath)\en\Symbols" />
</Target>
<Target Name="AfterClean">
<!-- Remove the extra packages (and their expansions) created by RestorePackages and RestoreLocalPackages above -->
<RemoveDir Directories="$(PackagesDir)" />
</Target>
</Project>

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="5.0.0" />
<!-- package id="EntityFramework.de" version="5.0.0" />
<package id="EntityFramework.de" version="5.0.0" />
<package id="EntityFramework.es" version="5.0.0" />
<package id="EntityFramework.fr" version="5.0.0" />
<package id="EntityFramework.it" version="5.0.0" />
@ -9,16 +9,6 @@
<package id="EntityFramework.ko" version="5.0.0" />
<package id="EntityFramework.ru" version="5.0.0" />
<package id="EntityFramework.zh-Hans" version="5.0.0" />
<package id="EntityFramework.zh-Hant" version="5.0.0" / -->
<package id="EntityFramework" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.SqlServerCompact" version="6.1.0-alpha1-21025" />
<!-- package id="EntityFramework.de" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.es" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.fr" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.it" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.ja" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.ko" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.ru" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.zh-hans" version="6.1.0-alpha1-21025" />
<package id="EntityFramework.zh-hant" version="6.1.0-alpha1-21025" / -->
<package id="EntityFramework.zh-Hant" version="5.0.0" />
<package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net45" />
</packages>

Просмотреть файл

@ -68,7 +68,7 @@ namespace Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb
var model = DbDatabaseMappingBuilder.Build(mappingContext);
Assert.Same(conceptualAssociationType, model.GetConceptualModel().AssociationTypes.SingleOrDefault());
Assert.Same(conceptualAssociationType, model.ConceptualModel.AssociationTypes.SingleOrDefault());
}
[Fact]
@ -138,7 +138,7 @@ namespace Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb
mappingContext.AddMapping(storeFunction, functionImport);
mappingContext.AddMapping(storeContainer, modelContainer);
var entityModel = DbDatabaseMappingBuilder.Build(mappingContext).GetConceptualModel();
var entityModel = DbDatabaseMappingBuilder.Build(mappingContext).ConceptualModel;
Assert.NotNull(entityModel);
Assert.Equal(new[] { "f_c" }, entityModel.Containers.Single().FunctionImports.Select(f => f.Name));
@ -177,7 +177,7 @@ namespace Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb
var mappingContext = new SimpleMappingContext(storeModel, true);
mappingContext.AddMapping(storeContainer, modelContainer);
var entityModel = DbDatabaseMappingBuilder.Build(mappingContext).GetConceptualModel();
var entityModel = DbDatabaseMappingBuilder.Build(mappingContext).ConceptualModel;
Assert.NotNull(entityModel);
Assert.Empty(entityModel.Containers.Single().FunctionImports);

Просмотреть файл

@ -55,7 +55,6 @@
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.WizardFramework" />
<Reference Include="Microsoft.WizardFramework, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />

Просмотреть файл

@ -141,4 +141,56 @@
</Task>
</UsingTask>
<UsingTask TaskName="ExtractNuspecFromPackage" TaskFactory="CodeTaskFactory" AssemblyFile="$(CodeTaskFactoryAssemblyFile)">
<ParameterGroup>
<NuGetPackageFilePath ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="WindowsBase" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.IO.Packaging" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var packageNameWithNoVersion = Path.GetFileNameWithoutExtension(NuGetPackageFilePath);
var firstIndexOfADigit = Int32.MaxValue;
for (var i = 0; i < 10; i++)
{
int index;
if ((index = packageNameWithNoVersion.IndexOf((char)('0' + i))) >= 0)
{
if (firstIndexOfADigit > index)
{
firstIndexOfADigit = index;
}
}
}
if (firstIndexOfADigit != Int32.MaxValue)
{
packageNameWithNoVersion = packageNameWithNoVersion.Substring(0, firstIndexOfADigit-1);
}
var nuspecOutputFilePath = Path.ChangeExtension(NuGetPackageFilePath, ".nuspec");
var nuspecPartPath = String.Concat("/", packageNameWithNoVersion, ".nuspec");
using (var package = ZipPackage.Open(NuGetPackageFilePath, FileMode.Open, FileAccess.Read))
{
string content;
var part = package.GetPart(new Uri(nuspecPartPath, UriKind.Relative));
using (var reader = new StreamReader(part.GetStream(FileMode.Open, FileAccess.Read)))
{
content = reader.ReadToEnd();
}
using (var writer = new StreamWriter(nuspecOutputFilePath))
{
writer.Write(content);
}
}
]]>
</Code>
</Task>
</UsingTask>
</Project>

Просмотреть файл

@ -22,7 +22,7 @@ Project global pre-settings.
<PropertyGroup>
<BuildingToolingProject Condition="'$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EFToolsPublicKey.snk))' != '' Or '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), VsIdeHostAdapter.sln))' != ''">true</BuildingToolingProject>
<BuildingRuntimeProject Condition="'$(BuildingRuntimeProject)' == '' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EcmaPublicKey.snk))' != ''">true</BuildingRuntimeProject>
<BuildingRuntimeProject Condition="'$(BuildingRuntimeProject)' == '' AND '$(BuildingToolingProject)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EcmaPublicKey.snk))' != ''">true</BuildingRuntimeProject>
</PropertyGroup>
<PropertyGroup>

Просмотреть файл

@ -47,8 +47,6 @@ Project global post-settings and targets.
<AssemblyVersion Condition="'$(AssemblyVersion)' == ''">$(VersionMajor).$(VersionMinor).0.$(VersionRevision)</AssemblyVersion>
<AssemblyFileVersion Condition="'$(AssemblyFileVersion)' == ''">$(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision)</AssemblyFileVersion>
<NuGetPackageVersion Condition="'$(NuGetPackageVersion)' == ''">$(RuntimeVersionMajor).$(RuntimeVersionMinor).$(VersionRelease)</NuGetPackageVersion>
<!-- TODO: FIX SETUP TO PICK UP NUGET PACKAGES FROM BUILD and remove the following hardcoded definition -->
<!-- NuGetPackageVersion>$(RuntimeVersionMajor).$(RuntimeVersionMinor).$(VersionRelease)-21025</NuGetPackageVersion -->
<EF6NuGetPackageVersion>$(NuGetPackageVersion)</EF6NuGetPackageVersion>
<EFPackageVersion>$(EF6NuGetPackageVersion)</EFPackageVersion>
<EF6NuGetPackageWixId>$(NuGetPackageVersion)</EF6NuGetPackageWixId>