-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 1.4.2 adds reference to Microsoft.WindowsDesktop.App #353
Comments
Ah and please treat it as a suggestion, the simplest fix is of course to downgrade to 1.4.1 :) |
This redundant reference will cause the ReSharper to break which will ruin the development experience, I hope it can be fixed so that I can upgrade the dependency |
Hi @Nefarion , thanks for the suggestion. I had a look into your scenario and came to the conclusion, that I won't change the setup for now. (As long as you have no other arguments after you've read my following explanation.) If I got you right, your problem is, that on Windows Server environments the Desktop related libraries (e.g. Microsoft.WindowsDesktop.App) aren't pre-installed and thus the application breaks in your case. Since you don't use XamlQRCode which needs this libraries, you expect QRCoder not to break. Correct? For that specific QRCoder (and the NuGet package) contains multiple target frameworks. Besides other it also targets So from my point of view, you are targeting the wrong framework in your application. If your environment does not have the desktop related libs available, then your application should target Why do I say you picked the wrong target? Microsoft docs read out as follows:
So picking So I see three possible solutions for your problem:
<!-- Find the package reference for QRCoder -->
<PackageReference Include="QRCoder" Version="1.4.2" />
<!-- Replace it with the following -->
<PackageReference Include="QRCoder" ExcludeAssets="Compile" Version="1.4.2" GeneratePathProperty="true" />
<Reference Include="QRCoder">
<HintPath>$(PkgQRCoder)\lib\net5.0\QRCoder.dll</HintPath>
</Reference> Explanation: By adding Please let me know, if this solves your issues. |
@dylech30th Can you please explain what you mean by "This redundant reference [...]". In how far there is a redundant reference? Furthermore please explain how this breaks ReSharper? Can you please read the comment above I wrote for Nefarion and see if this is a solution for you, too? And if not, could you please open a new issue? For me it sounds like this may not directly be related to eachother. |
To add some perspective, we have projects targeting As I read the quoted docs, targeting |
@jnyrup Correct, targeting Nevertheless, if one doesn't want to use Windows related stuff, simply In case you want to use some Windows features, thus targeting your app Or do I oversee something? |
@codebude I totally forgot about Exclude and Include on Packages, thank you for the Workaround, i'll use it! |
My ReSharper reports ambiguous references in the XAML file on my WinUI 3 project (says it cannot choose between And I've also assured that it's not ReSharper's problem as a new WinUI 3 project without any package reference works correctly, I've updated my NuGet package one by one and found the problem happens in this library, you can clone my project, update QRCoder to 1.4.2 and try to build solution in the following environment(even though I suspect that the problem will also raise in R# 2021.2 and VS 2019), the solution will be built successfully, but ReSharper will then report false positive (?) ambiguities in XAML file like the one's I've posted above. My Environment: After comparing the dependencies of 1.4.1 and 1.4.2 I've found that 1.4.2 is targeting SDK |
@codebude solution 3 works for me, I thought I had already tried it, but I must have failed to recompile properly. |
@dylech30th In QRCoder 1.4.1 there was no target for net5.0/net6.0. So in that case if you target your application to Same story as for @Nefarion - I suppose you to either target your app to Alternatively use using-statements with aliases and prefix the calls. e.g.: using UI = Microsoft.UI.Xaml.Controls;
using SW = System.Windows.Controls;
// Then use either UI.DataTemplate or SW.DataTemplate ... In addition I think this isn't the fault of QRCoder. Libraries that target |
I suppose so, sadly solution 3 didn't solve my problem (I've already modified the path to reveal the correct location by changing |
@dylech30th Alternatively try to use using-aliases as shown one comment above. ;-) |
if I do exactly as solution 3 says the build will fail with the message:
and I've also tried using-aliases, however, it won't work for the binding expression( |
Hi @dylech30th , The error |
Sorry none of them works...the problem is still there after I've purged the cache, and the |
Can you open a ticket at Jetbrains/Resharpen? |
Ummm, I mean the build failure still exists ( |
Hi @dylech30th , I still don't see what should be wrong. Are you sure that this isn't a problem/bug with ReSharper or your development environment? I just forked your app and checked out the current master branch. I opened the solution in Visual Studio 2022 (17.0.0 Preview 7.0). Then I changed the QRCoder reference to 1.4.2 via NuGet package manager. After that I tried to build the solution. No build errors and no error in the error list were shown: A quick run-tests/debugging session also worked without problems: So I don't see what should be wrong with QRCoder. |
Sorry to backtrack on this... |
@Nefarion Is your solution publicly available? I would like to fiddle around to see what's wrong or can you setup a minimal project/solution to show what's wrong? I tried it myself, but couldn't reproduce your problem. What i did:
I really would like to understand what's going on and why it isn't working for you. |
@codebude Ummm that's weird because it seems that it will fail on my machine, I'll try to figure it out to see if it's due to my environment or the ReSharper. |
@codebude
if you look at the respective Thank you for taking the time! |
Since it seems to make more trouble than expected, I'll decouple XamlQRCode and QRCoder and also add net6.0 and net6.0-windows as targets. (This should solve the problems due to removal of the problematic dependencies from QRCoder.) |
Hi @jnyrup , @Nefarion , @dylech30th , I decoupled XamlQRCode (and its Windows-dependencies) from QRCoder and put it into a seperate package. Before public release on NuGet, I would like to get some feedback. (Do the changes solve your problems?) Can you please take the latest CI-build and check if it's working for you? CI-Build Packages If you need help on how to use Github Packages as NuGet package source, let me know (or check this article). |
I just tried out the 1.4.3-preview and it solves the problem I had. |
Version 1.4.3-ci-20211209065116 also solves my problem! |
My problem is solved using the preview version, thanks for your efforts! |
Thanks for your help, testing and patience. QRCoder 1.4.3 was released right now: https://www.nuget.org/packages/QRCoder/ |
Type of issue
[ ] Bug
[ ] Question (e.g. about handling/usage)
[x] Request for new feature/improvement
Expected Behavior
No targeting
Microsoft.WindowsDesktop.App
Current Behavior
The v1.4.2 package adds a dependency to
Microsoft.WindowsDesktop.App
to projects targeting .net5.0-windows or .net6.0-windows.Many AspNetCore applications run on windows servers that do not have the
Microsoft.WindowsDesktop.App
runtime/target installed, and thus do not start any more after upgrading to v1.4.2Possible Solution (optional)
Isolate WPF functionality into a new package? It is only the
XamlQRCode
that requires the references toPresentationFramework
/Microsoft.WindowsDesktop.App
.Your Environment
Version 1.4.2
TargetFramework: .net6.0-windows
The text was updated successfully, but these errors were encountered: