You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Solution Explorer, right click the class library project and select “Edit Project File”.
Update the TargetFramework element to reference the Windows SDK, e.g. “net5.0-windows10.0.19041.0”
Add a new PropertyGroup to the project file with <PropertyGroup> <CsWinRTIncludes>CPPWinRTInteropRepro</CsWinRTIncludes> <CsWinRTWindowsMetadata>10.0.19041.0</CsWinRTWindowsMetadata> </PropertyGroup>
Save and close the CPPWinRTInteropReproProjection.csproj file.
In Solution Explorer, right click the “Dependencies” node under the CPPWinRTInteropReproProjection project, select “Add Project Reference”, and select the CPPWinRTInteropRepro project.
Add a new C# .NET 5 console application (e.g. ConsoleApp1).
In Solution Explorer, right click the console application project and select “Edit Project File”.
Change the TargetFramework to “net5.0-windows10.0.19041.0” to match the projection project.
Add this property to ConsoleApp1: <PropertyGroup><CsWinRTWindowsMetadata>10.0.19041.0</CsWinRTWindowsMetadata></PropertyGroup>
Save and close the ConsoleApp1.csproj editor/window.
Install the “Microsoft.Windows.CsWinRT” NuGet package into ConsoleApp1.
In Solution Explorer, right click the “Dependencies” node under the ConsoleApp1project, select “Add Project Reference”, and select the CPPWinRTInteropReproProjection project.
Add this code to Program.cs: var someObject = new Class();
Add a using statement to the top of the file: using CPPWinRTInteropRepro;
Build ConsoleApp1. This should succeed.
Open Class.idl and add a new property (i.e Int32 NewProperty)
Build the C++ project.
Copy the generated class.h and class.cpp files into the main CPP project (copy the files from the folder Generated Files\sources to CPPWinRTInteropRepro ? and replace them ?).
Remove the static asserts that cause build to fail (comment the line that contains static_assert in class.cpp and class.h)
Build the C++ project, this should succeed.
Build the C++ again, until the project is marked up-to-date
Reference the newly added property in ConsoleApp1 (Add the statement someObject.NewProperty = 0 to Program.cs).
Build ConsoleApp1.
Expected Behavior:
Building the console app (which depends on the interop project) should succeed.
Actual Behavior:
Building the console app fails.
User Impact:
Users need to rebuild the interops apps manually after changing the C++/WinRT sources.
Summary:
C#/WinRT Interop projects are considered up-to-date after changing C++/WinRT Sources when fast Up To Date checking is enabled
Steps to Reproduce:
<PropertyGroup> <CsWinRTIncludes>CPPWinRTInteropRepro</CsWinRTIncludes> <CsWinRTWindowsMetadata>10.0.19041.0</CsWinRTWindowsMetadata> </PropertyGroup>
<PropertyGroup><CsWinRTWindowsMetadata>10.0.19041.0</CsWinRTWindowsMetadata></PropertyGroup>
var someObject = new Class();
using CPPWinRTInteropRepro;
Expected Behavior:
Building the console app (which depends on the interop project) should succeed.
Actual Behavior:
Building the console app fails.
User Impact:
Users need to rebuild the interops apps manually after changing the C++/WinRT sources.
C++/WinRT Resources:
Version Info
Additional context
Copied from dotnet/project-system#7067
The text was updated successfully, but these errors were encountered: