Trying to add a reference to my solution - c#

I am a complete stranger to adding "custom" references to my projects, usually everything I need I can find in NuGet packages. Ive come across a problem and the solution I've found is to add the following reference to my project:
https://microsoftdwayneneed.codeplex.com/
Ive downloaded the source code, opened up the project in VS and hit build. I then went into the bin/Release folder and added the .dll for both Win32 and normal which I assume is any CPU.
The problem I faced earlier is now fixed, however now a new problem arised: I keep getting the message that the Microsoft Visual Studio XAML UI Designer has stopped working. The error it gives is a NullReferenceException and in the name is "dwayneneed" so I can only assume that I messed up adding the reference.
Can someone explain to me how to add references like the one above correctly to my solution.
The problem Im trying to solve for those wondering:
https://github.com/MahApps/MahApps.Metro/issues/488
the solution, see: https://github.com/MahApps/MahApps.Metro/wiki/FAQ

Do you mean adding a solution to the solution, like this.

Related

Azure Functions(.net core 3+) - Getting "Entry point was not found" error when trying to access HttpRequest.Query

I started encountering this issue about 3 days ago after an update that I randomly clicked on when I was in Visual Studio Code. Whenever I try to access HttpRequest.Query from the Microsoft.AspNetCore.Http namespace, I get an the following error message: "Entry Point was not found".
I have not been unable to fix this and this has interrupted my ability to work. I've talked this over with my teammates, and they are not encountering this issue at all.
I've tried pretty much everything I could google and think of.
Auto Generating Bindings
Deleted and re installed every Nuget Package at C:\Users{username}.nuget\packages
Deleting and reinstalling everything about Visual Studio and Visual Studio Code
Using the most recent versions of Microsoft.NET.Sdk.Functions
Deleting the bin and obj folders of my project
Removing unused references in my project
At this point, I'm not even sure what's really wrong any more. I found a post with my EXACT SAME issue, but the way the person fixed it did not apply to me:
Azure Functions .NetCore 3.0 Request.Query throwing "Entry point not found" error
Some Info- may or may not be useful.
When I go through the code step by step in the debugger, HttpRequest.Query shows up properly with all of the keys. I'm wondering if there is some kind of name conflict between HttpRequest object from Microsoft.AspNetCore.Http vs System.Web
If I set my project to use the most recent version of Microsoft.NET.Sdk.Functions, I get a new error instead of an entry point error, I get this instead:
I'm using Visual studio Code.
Can anyone assist? I'd be happy to provide any information needed!
I gave up. I spent about 3 days trying to solve this and this was affecting my ability to work. I just had my entire laptop reformatted and that "fixed" the issue. I tried pretty much everything I could find and nothing worked and I couldn't wait any more. Best of luck to anyone who encounters this!

References not updating properly in Visual Studio

I am working on a rather large project in visual studio, and I have several references to other solutions and projects within my current solution. One of my user controls resides in a separate solution, so I need to consistently be able to update the DLL to fit any changes to my code. The only problem is, Visual Studio will not update my references unless I go through a long, meticulous process which I will try to describe now:
First, I must clean and rebuild the solution that contains the changed code. Here is a snippet of the class I need to update:
I just added the highlighted property, so my other project does not recognize it yet. I used blank properties like HelloWorld and ISuddenlyDespiseYogurt because they are easy to spot in code and properties will show in the compiled version of the code.
Secondly, I must go to the project I am trying to use the DLL in, delete the reference, and re add it.
I right click on the reference I want, click delete, then right click on the "References" tab, press "Add Reference", then I use the file path of my other solution and update the reference.
Lastly, I must restart Visual Studio and reopen the project I was working on.
And now our new property is recognized by my project. This solution works every time, but it is a ridiculously annoying workaround, and I am hoping someone out there knows how to make this process much easier.
This is the closest thing I can find to a similar problem on StackOverflow, and the rest of the internet is no help. If anyone has any clue how to fix this problem, I would very much appreciate your insight.
I have a feeling that your project is copying the library .DLL to your project folder, instead of linking over to the Hamilton.HST project's Release folder.
Two things I would check from your side: when you're linking the reference and clicking 'Browse', where exactly are you grabbing the .DLL from? Hopefully the Release folder, or some other output that changes when the Hamilton.HST project is recompiled. And second, check your main project and the properties on the Reference, to make sure it's pointed to that Hamilton.HST folder (like I said, I have a suspicion its pointing to somewhere in your second project's folder, and that VS copied the DLL over instead of linking.)
I managed to fix the problem, hopefully for good. For the sake of anyone else who may have this problem, here is my solution:
I went into the "Properties" tab of my project, by right clicking on the project name in Solution Explorer and clicking "Properties". I then navigated to "Build Events", where I saw something like this:
The first two lines were there when I opened the window, and I added the last line. From what I can gather, the addition of that line tells my program where to look for updated DLL's upon building the project, and I had the wrong location before.
Other than that, I have no idea how this solution worked, but hopefully it can work for someone else. If anyone knows the logic behind this solution, please let me know so I can clarify my answer. Thanks to everyone who gave me suggestions to fix this!
Visual Studio 2019. The error was misleading in my case. After building one project at a time, I ran into the actual build error in one of the projects, which prevented that project from compiling and therefore caused the missing dll error. Once the issue was resolved, everything built properly.

Reference Missing After Nuget Package Update

I want to start off by saying I've been really hesitant to ask this question because it seems like it should be such a simple thing, however, I've scoured the internet and all I can find is the basic solution to something similar to my issue.
I have a nuget package that is v 1.30 and I'm trying to update it to 1.41. I've used the NuGet UI and I've also used the Package Manager Console to do this multiple times with small variations and I continue to get the same result. After I do something like "Update-Package PackageName" my package updates correctly. NuGet deletes the old reference and the old files and the 1.41 version is referenced by all the projects in the solution using that package. When I look at the Code, there are no syntax errors, Visual Studio seems to think the reference is just fine and I can even ctrl+B (re#er) to 'go to declaration.' However, when I build, every place I have 'using PackageName' in code throws an error that says
"The type or namespace name 'Common' does not exist in the namespace 'PackageName' (are you missing an assembly reference?)"
I have tried cleaning my solution. Then building. I've tried resetting through Git, cleaning the solution, updating then building. I've tried updating, cleaning, deleting the reference, building (will get the errors obviously), then adding the reference back in manually and building. Every time I try I get the same error. It's only happening for my Core project, but all my other projects depend on the Core, so they won't build anyway. I'm assuming this issue would still present itself if they were able to build. I've looked at the properties of the reference, it is referencing the v 1.41 file and it is set to Copy Local = True (I read somewhere someone suggested looking at that).
I'm open to suggetions for things to try. I don't have any code changes that I'll lose of I do a Git Reset, so I can try whatever.
Thanks Internet.
After trying several different things, we figured out it was a version mismatch with ASP.NET. Someone had pulled in a newer package that required updating to ASP.NET 4.5 and the solution I was working in was still ASP.NET 4.0. After updating to 4.5 the problem with the references was resolved. But we ran into some new Automapper issues. One thing after another. However, if you're banging your head against your desk in frustration because of this problem, check the framework version of your projects and the package you're updating.

Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute'

I'm trying to run a .NET MVC application on my local computer that I got from GitHub.
When I hit run on Visual Studio, everything complies and a new browser window opens with the error:
CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute'
The compiler section in the same window, shows the following error:
I've checked on google and this seems to be the same error.
This guy was using a dynamic type himself, on the other hand I'm not using any dynamic type, this is being auto generated by .NET's compiler, and I'm using .net 4.5 which should has support for dynamics.
I tried to apply the same solution (Changing all System.Core references to 4.0)
but the thing is that all of them are version 4.0 already.
Do you have any idea how could I resolve this?
I had a similar error on a project I was trying to migrate. Try re-targeting the framework of the project back a version or two, and once you find a target version where you do not get the error, re-target back to the version you originally had trouble with.
I was getting the same error on a website project targeted for 4.6.2 that was referencing some older libraries, re-targeted it back to 4.5.1 and that resolved the error. I immediately re-targeted back to 4.6.2 and did not encounter the error again.
I had this same issue, but none of the answers here solved it, but did point me in the right direction. I think I didn't update the .NET version on my machine to the newer one. After installing it, I rolled back the targeted framework (as was suggested), retargeted the newer framework, and did a few extra things also:
Reinstalled ALL packages by running this in the package manager:
update-package -reinstall
I also compared my project to one that was working for 4.5 and did this:
Opened my project file and removed all "BCL" related elements.
Uninstalled all "BCL" packages in the NuGet package manager for the project (guess it's not needed moving to 4.5+...?)
Removed an old package version of System.Net.Http, which did not get updated for some reason (see web.config - versions should show oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0").
Have to restart VS.
Rebuild solution.
Error is now gone. ;)
One other thing I did to resolve some other errors was to clear the component cache by deleting all files in here:
C:\Users\{USERNAME}\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache\
[rant] Wasted a whole day with all this. Thanks to MS for stealing one more day of my life fixing senseless issues that should never be. Every time I upgrade I always get a wonderful surprise, and a lovely game of fix the red herring. Would it not hurt to detect these conflicts for those upgrading old projects? Perhaps better error traces when things go wrong? I doubt it would be that difficult. Perhaps even something like AsmSpy, but more advanced, built in to VS? [/rant]
Saw this in VS 2019. I excluded and re-included the problematic file (in my case _Layout.cshtml) and that fixed the problem.
I got this error suddenly a couple days after updating to VS2015.3 using 'traditional' MVC app (not new .NET Core / vNext app).
Turns out this error can be a complete red herring.
Make sure:
You haven't got any other errors at all
You've checked the output window for any errors that don't show in the 'Output' window.
Make sure you don't have any conflicting references
In my case I had a typescript error that was causing an error and for some reason triggering this weird 'red herring' dynamic error too.
My fix was to go into the .csproj file and update the typescript tools version to 1.8 (need to unload project and edit by hand). As I said this is unrelated to the error, but I mention the specifics because someone else may end up with this same problem.
I believe that 1.7 didn't accept 'None' for the typescript module system whereas 1.8 does, hence the error.
Adding a reference to System.Dynamic.Runtime did it for me.
I hesitate to write this as an answer, but for me the error appeared in a .cshtml file. I closed the page, rebuilt, and the error vanished. Always best to try the simple things first.
I had the same error, there were just 2 unused tables of my databaseset that I had to delete. I wonder why it worked when I manually change sth in an auto-generated code work but after deleting, it worked.
So be aware that such inconsistencies can also cause this error.
My solution was to correct the version of MVC in web.config under Views folder. E.g. the project referenced MVC assembly version 5.2.2.0 but in the Views/web.config file was version 5.2.4.0 (see image).
Image
Tried a few other answers with no luck, but the overall consensus appears to be that this some sort of issue with cached build artifacts or compiler state or something. Here's what worked for me:
Delete the problem .cshtml file, watch error disappear
Open source control and revert the deletion
This error will come because of the different versions of your Sitecore.Web.Mvc.Dll in solution reference folder(Project name->References->Sitecore.Web.Mvc->right click and check properties) and the version of Sitecore.Web.Mvc.Dll in Web.Config in views Folder.
For solving this error you have to make sure that the version of Sitecore.Web.Mvc.Dll is same in both folders.
Thanx.
For my case, I fixed to run the command line "update-package -reinstall" on the Package Manager Controler.
My problem was in the _Layout.cshtml.
None of the solutions above did the trick for me. I am using VS2017 for this project, upgraded an ran into the same message.
I had commented out a 2 lines in 1 comment #* *#
My solution was to comment out each line separately. What a mystery!
A few hours lost on this.

Getting mysterious build error after upgrading solution to Windows 8.1

I have used windows store apps 8.0 in my project and upgraded it to be 8.1. And also upgraded Visual Studio from 2012 to 2013.
First, I got an error that cannot use the Microsoft.VCLibs Version 11.0 and 12.0. So I removed the 11.0 version.
And then I got this errors:
I tried to find some information on the internet, but nothing.
Also when I double clicked on the error it doesn't bring me to the error's spot.
I have tried to do many things, and nothing helped, so I decided to write this post.
Can someone help me resolve this errors?
EDIT:
I am adding some more information, maybe this can lead to the problem:
Solved:
With the help of Hans Passant the errors have fixed. The problem was that I had this duplicate on my resource file:
I did it twice because one is for buttons (that has content), and one is for message dialogs on code behind.
In Visual Studio 2012 this code was working fine, but somehow, not in Visual Studio 2013.
I deleted the row of Cancel.Content and the errors disappeared and it works fine :)
Here is somebody else with the same problem.
I'll just copy Caplan's guidance. Look through the .resw file(s) in your project and look for a duplicated "Cancel" resource. I should note that intentionally forcing a duplicate resource produced another message when I built the program on VS2013:
1>MakePri : error 0x80073b0f: Processing Resources with error: Duplicate Entry.
1>MakePRI : error 0xdef00532: Conflicting values for resource 'Resources/String1'
Same message from either duplicating the resource in the same .resw file and by making a copy of the .resw file and adding it to the project. So Caplan's explanation isn't exactly a slam-dunk. I'd pay attention to other projects in your solution that might also have a resource named "Cancel". A likely scenario when your solution has a dependency on VCLibs, that sounds like you are mixing C# and C++/CX.
I came across this MSDN URL which seemed to be pretty helpful.
2 snippets in particular you could try:
You could actually have a duplicate resource entry in your project file.
Your obj files could have become corrupt, you need to clear out your obj files (although I haven't seen this problem for a while in my
team - it might be fixed in 2008).
If you are using a custom culture, perhaps with the .Net RegisterCulture method, ensure that the culture has been registered on
your computer. If you've reinstalled your OS and installed VS2008 and
you can't build due to this problem it could be because you need to
register your custom cultures before you build. This error seems to
be thrown when msbuild cannot find the culture.
Alternatively:
PS - There is also a Visual Studio 2012 Update 3 available that could possibly help?
Visual Studio 2012 Update 3
I hope this helps.
A similar error can also occur if you update a Nuget package in one project, but not in another dependent project also using the same Nuget package.
i.e. it can be a version mismatch error when referencing different versions of a dependency across two dependent projects.
I don't know if you have tried re-installing VS 2013, I was getting the same error but it was resolved when I re-installed.
In my case, after retargeting a working Win8 App for Win81 App, was UI string. Imho it is correct but soehow the VS2013 has some problems with it.
Locations SomeString
Locations.Text SomeStringForUI
Removing the one of them solved my problem.
Recently i got a similar build exception on my UWP Project
MakePri : error 0x80073b0f: Processing Resources failed with error: Doppelter Eintrag.
MakePRI : error 0xdef00532: Conflicting values for resource 'System.Design/ClassComments1'
I found a lot of information about the error but no solution. It looks like the error must be in the entry application project but it isn't.
In my case the VS integrated automaticly a reference to System.Activities because a made a mistake.
After i deleted the wrong reference, it works fine again.
Got this error in a UWP Xamarin.Forms project when a fellow developer referenced System.Web in a PCL that the Xamarin.Forms PCL references.
For more info:
Add System.Web Reference To A Windows 10 Universal App

Categories