dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.05k stars 1.17k forks source link

How to test API changes? #4029

Open Symbai opened 3 years ago

Symbai commented 3 years ago

I've followed the guide and added the lines to my csproj file. I've changed the Wpfrootpath and fixed the Reference paths.

    <PropertyGroup>
        <!-- Change this value based on where your local repo is located -->
        <WpfRepoRoot>C:\Users\abc\source\repos\wpf</WpfRepoRoot>
        <!-- Change based on which assemblies you build (Release/Debug) -->
        <WpfConfig>Debug</WpfConfig>
        <!-- Publishing a self-contained app ensures our binaries are used. -->
        <SelfContained>true</SelfContained>
        <!-- The runtime identifier needs to match the architecture you built WPF assemblies for. -->
        <RuntimeIdentifier>win-x86</RuntimeIdentifier>
    </PropertyGroup>
    <ItemGroup>
        <Reference Include="$(WpfRepoRoot)\artifacts\packaging\$(WpfConfig)\Microsoft.DotNet.Wpf.GitHub.Debug\lib\netcoreapp5.0\*.dll" />
        <ReferenceCopyLocalPaths Include="$(WpfRepoRoot)\artifacts\packaging\$(WpfConfig)\Microsoft.DotNet.Wpf.GitHub.Debug\lib\netcoreapp5.0\*.dll" />
    </ItemGroup>

My API changes are recognized by VS. However I cannot build as I get the following errors:

Assembly XX with identity XY uses ZZ which has a higher version than referenced assembly ....

Error   CS1705  Assembly 'PresentationFramework' with identity 'PresentationFramework, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'   
Error   CS1705  Assembly 'PresentationCore' with identity 'PresentationCore, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 
Error   CS1705  Assembly 'WindowsBase' with identity 'WindowsBase, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'   
Error   CS1705  Assembly 'PresentationFramework' with identity 'PresentationFramework, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'   
Error   CS1705  Assembly 'PresentationFramework' with identity 'PresentationFramework, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'   
Error   CS1705  Assembly 'PresentationCore' with identity 'PresentationCore, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'     
Error   CS1705  Assembly 'WindowsBase' with identity 'WindowsBase, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'       
Error   CS1705  Assembly 'PresentationFramework' with identity 'PresentationFramework, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'       
Error   CS1705  Assembly 'PresentationFramework' with identity 'PresentationFramework, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'       
Error   CS1705  Assembly 'PresentationCore' with identity 'PresentationCore, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'     
Error   CS1705  Assembly 'WindowsBase' with identity 'WindowsBase, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'       
miloush commented 3 years ago

For reference, #3132 is how my attempt went.

Can you either get the older System.Runtime or update the references to the newer version?

Symbai commented 3 years ago

And from where do I get the required System.Runtime version?!

lindexi commented 3 years ago

@Symbai I use github action to package the NuGet package, and then I download it from github action. Then I unzip the NuGet package and copy all the dll file to my folder, such as F:\temp\CustomWPF folder. I add the code to my demo project.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5-windows</TargetFramework>
    <UseWPF>true</UseWPF>
  </PropertyGroup>

  <PropertyGroup>
    <AssemblyOriginatorKeyFile>dotnet-campus.snk</AssemblyOriginatorKeyFile>
    <SignAssembly>true</SignAssembly>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="f:\temp\CustomWPF\Accessibility.dll" />
    <Reference Include="f:\temp\CustomWPF\DirectWriteForwarder.dll" />
    <Reference Include="f:\temp\CustomWPF\Microsoft.VisualBasic.Forms.dll" />
    <Reference Include="f:\temp\CustomWPF\Microsoft.Win32.Registry.AccessControl.dll" />
    <Reference Include="f:\temp\CustomWPF\Microsoft.Win32.Registry.dll" />
    <Reference Include="f:\temp\CustomWPF\Microsoft.Win32.SystemEvents.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationCore.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework-SystemCore.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework-SystemData.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework-SystemDrawing.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework-SystemXml.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework-SystemXmlLinq.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.Aero.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.Aero2.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.AeroLite.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.Classic.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.Luna.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationFramework.Royale.dll" />
    <Reference Include="f:\temp\CustomWPF\PresentationUI.dll" />
    <Reference Include="f:\temp\CustomWPF\ReachFramework.dll" />
    <Reference Include="f:\temp\CustomWPF\System.CodeDom.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Configuration.ConfigurationManager.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Design.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Diagnostics.EventLog.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Diagnostics.PerformanceCounter.dll" />
    <Reference Include="f:\temp\CustomWPF\System.DirectoryServices.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Drawing.Common.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Drawing.Design.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Drawing.dll" />
    <Reference Include="f:\temp\CustomWPF\System.IO.FileSystem.AccessControl.dll" />
    <Reference Include="f:\temp\CustomWPF\System.IO.Packaging.dll" />
    <Reference Include="f:\temp\CustomWPF\System.IO.Pipes.AccessControl.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Printing.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Private.DataContractSerialization.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Private.Uri.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Private.Xml.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Private.Xml.Linq.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Resources.Extensions.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.AccessControl.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Cryptography.Cng.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Cryptography.OpenSsl.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Cryptography.Pkcs.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Cryptography.ProtectedData.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Cryptography.Xml.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Permissions.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Security.Principal.Windows.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Threading.AccessControl.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Controls.Ribbon.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Extensions.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Forms.Design.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Forms.Design.Editors.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Forms.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Forms.Primitives.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Input.Manipulations.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Windows.Presentation.dll" />
    <Reference Include="f:\temp\CustomWPF\System.Xaml.dll" />
    <Reference Include="f:\temp\CustomWPF\UIAutomationClient.dll" />
    <Reference Include="f:\temp\CustomWPF\UIAutomationClientSideProviders.dll" />
    <Reference Include="f:\temp\CustomWPF\UIAutomationProvider.dll" />
    <Reference Include="f:\temp\CustomWPF\UIAutomationTypes.dll" />
    <Reference Include="f:\temp\CustomWPF\WindowsBase.dll" />
    <Reference Include="f:\temp\CustomWPF\WindowsFormsIntegration.dll" />

  </ItemGroup>

</Project>

And I write a blog in Chinese to tell my friends how to do it, see Google translate Blog

lindexi commented 3 years ago

But I think the best way is to store a demo project in this repo

miloush commented 3 years ago

Shouldn't we be able to just use the WpfRepo, WpfConfig and SelfContained properties as suggested in the Developer Guide?

lindexi commented 2 years ago

I think we can close this issues. Because we add the wpf-debug.targets file.