I have a WPF application built on .Net 4.8, Prism and Unity, using PackageReference in the project files. Every once in a while I update Nuget references to the newest ones. The packages related to Prism and Unity repeatedly have been a pain in the arse.
Now is such a moment again. Or rather, the past DAYS. I am trying to use packages like
Prism.Wpf 7.2.0.1422
Unity.Container 5.11.8
I keep bumping into the dreaded "The located assembly's manifest definition does not match the assembly reference", again & again in various variations. Seeing warnings like "Found conflicts between different versions of ... that could not be resolved", or "explicit binding redirect on ... conflicts with an autogenerated binding redirect".
I have been tinkering with this a lot, checking a whole dependency tree, removing, adding, or changing redirects, adding or removing packages. Of course searching on the web. It has driven me nuts. How to get out of this, and prevent it for the future?!
I don't know if this is combination of bugs somewhere, or just me not understanding how to use it. So I will put this as a question.
How on earth am I supposed to get things working?!
Set AutoGenerateBindingRedirects or not?
Set explicit redirects or not? If so, for which versions, to which other version? What about the publicKeyToken?
What about testing projects using MSTest, Moq, Appium, do they need a different approach?
Frankly, I was under the impression that using Nuget to install packages would just take care of all that, particularly using PackageReference. Well apparently, it doesn't.
I am at a loss. Is there anyone who can direct me to a valid approach?
Thanks in advance!
Related
I would like to start incorporating commitizen in my repository; however, implementation seems to revolve around adding a js dependency on the repository, and calling it independently (and enforcing it with a hook).
My project currently is python, but that's besides the point - it seems to me that commitizen should be able to be orthogonal to the underlying repository.
However, I don't understand how would that be possible. Maybe the instructions don't exist, or I have not yet separated them from the "main usage path".
Good question #Stavros. I have recently been playing with it and started to have the same question. I tried to find an answer from its documentation https://commitizen-tools.github.io/commitizen/ but could not find it. Based on my testing, it seems to me that it only supports Python projects. However by the way it works, it should be able to support all Git projects.
I get this error only at design-time.
At runtime everything works just fine. There is absolutely nothing wrong with I-Synergy.Resources class library.
I've searched for this error intensively but no solution.
(already tried:
reset settings VS
clear and rebuild solution
delete obj and bin folders
checked all references and dependencies
converted pcl to regular class library
)
As you probably know, there a lot of questions regarding the notorious "Could not load file or assembly" error many times creeping up our XAML designer.
After reading all the provided solutions, and sadly non of them working for me, I started to investigate this annoying issue.
I spend 4 days trying to figure this out. Luckily today I found the answer to my problem.
In my solution design I created several projects under the WPF application called I-Synergy. Among others I added assemblies named I-Synergy.Controls and I-Synergy.Resources (where I put all my Resource strings, static classes and images).
This last assembly seems to caused this error. Even I don't have any Resouces file (or any other local reference inside the WPF application) it somehow got confused with my I-Synergy.Resources project.
Solution:
I changed the I-Synergy.Resources project to I-Synergy.Library (assembly name and namespaces) and the error has gone. Probably the "Resources" name is a no-go and can be considered as a reserved word.
I have a C# Windows Forms project in which I use a component that I obtained through nuget. Now I was wondering what is the correct way of adding this component to the toolbox in the designer. Should I make a separate copy of the component on my hdd and add it from there or should I just add it from the project's packages folder or maybe do something different entirely?
I was wondering if:
having a separate copy of the component won't cause problems if I use a newer version of the component in another project?
using the copy from packages folder and then deleting, moving the project, won't that cause problems with the toolbox?
Based on the conversation I had with Hans Passant in the comments (since he didn't post it as an answer):
Normally, when you get a windows forms component from nuget, it will automatically get added to the designers toolbox. The only time when it should not happen is when "Automatically Populate Toolbox" is set to false (Tools > Options > Windows Forms Designer > General).
In my particular case this does not happen. It might be related to "non-trivial dependencies that cannot be found at design time". But I'm not entirely sold on that, because I remember not being able to use such components in the designer at all, however the component that lead me to asking this question can be used there just fine. However this is likely material for a different question (and possibly on a different site).
'Lo again,
My Dotfuscation efforts continue! So I'm currently working on obfuscating a reasonable complicated WPF application consisting of ~38 assemblies. Now that I've overcome my performance issues (Speeding up obfuscation process), I've now moved on to testing out the BAML obfuscation capabilities of Dotfuscator v4.10.
Trouble is, it ain't working - the errors (well, warnings) that are generated are all of the same form, for which I can find nothing on the 'net that discusses:
BamlAnalysis flagged something in Data Binding Path: SOMEFIELDNAME in
SOMERESOURCEPATHTOBAML.baml for the following reasons:
Could not resolve, may have to manually exclude.
Anyone come across this and have any insight what the heck it wants me to change?
[EDIT:] Even setting up manual excludes on the properties its complaining about does not remove the warning...and it doesn't appear as if the underlying BAML is altered at all (at least not by visual check via reflector).
[EDIT2:] Also, should state that Dotfuscator is a requirement here, so alternative tools probably won't help me.
You can try using the latest version of Eazfuscator.NET to obfuscate complex WPF applications. XAML renaming is powered by a perfect analyzer which takes bindings, commands and every other aspect of XAML into account to deliver the precise results.
Got a Win7 box with VS2010 Premium installed on it.
Building desktop apps works just fine.
But we got this solution with 15 SL4 and 21 desktop projects... Building the SL part of it takes too long. This is very irritating and encourages to drop TDD since every time I run a test it takes ~3 seconds for msbuild to find out that nothing changed and the project should be skipped. The projects are very small and there's nothing fancy in them and we hadn't any problems before we switched from VS2008+SL3.
I've heard people complaining abound VS2010 speed in general, but nothing about SL4 build time.
Is anyone experiencing same problems and is there any workaround for this?
Do you need that many projects? As a rule of thumb, less is better. You say that the projects are very small, that would be an indication to me that you probably don't need that many.
Don't use it for managing dependencies (cycle avoidance). If you're trying to manage 'units of development' or logical groupings, use namespaces instead.
Physical/project separation is good for keeping test code out of production code, and managing units of deployment, but don't separate it until you're getting something out of it.
Patricks Smaccia wrote a good article on when and when not to create assemblies.
Another way to tackle the problem is to break your solution up into multiple solutions, and
use references to the dlls produced by the other solutions. That way, you only build part of it at a time. If you need to work across many dlls at the same time, this is inconvenient, but it's a sign that something is likely to be wrong with the design of your code.
This post on speeding vs.net up with many projects may also help.