I'm trying to create a Monogame Project in Visual Studio 2012. Monogame itself is installed correctly, I've cloned one of my older projects from github and it compiles fine.
But if I create a new project in Visual Studio the .dll references are wrong. There is a build error that complains about not finding SDL.dll . There is the SDL.dll reference in my project outline and it indeed points to the wrong file:
This path "C:\Users\lhk\Program Files..." does not exist. Windows doesn't store Program files in its "Users" folder.
I opened the explorer and opened the very same path without "Users\lhk\" and the .dll is found.
Then I checked my older project again. The same SDL.dll is referenced in the Visual Studio solution but the path is the correct one. And the older project compiles just fine.
Somehow the Monogame Project template fills in the wrong paths.
Now here's the problem:
I can't edit that reference.
The text is greyed out and not editable and I didn't find the correct settings to change the reference.
Oh, the problem is solved:
I tried drag-and-drop with the dll.
So far Visal Studio always complained that there is an existing file with the same name.
I tried to "cut" the wrong .dll but that only made its icon slightly transparent. The new .dll still couldn't be added.
Turns out that the ENTF key can do what cutting can't.
I'm afraid I never got the idea that I could delete it with ENTF after cutting didn't work. Now its gone.
I dragged the new dll over to the project.
Compiles fine
Apparently you can just drag and drop references to a project.
At first I thought this wouldn't be possible because the wrong .dll just couldn't be deleted. I tried to "cut" it from the project but it just changed the color of its icon and persisted.
With the old .dll still intact the new one couldn't be added.
I'm afraid the solution is extremely simple. You can just remove this reference by pressing "ENTF" - it's rather embarrassing. But I never thought this would work after cutting had no effect.
With the old reference having been removed you can indeed drag and drop the new one.
The project compiles fine.
What I did is create a path on the drive and put the sdl.dll file there. So whenever I make a project Visual Studio finds it.
Related
I have a primary project which refers to DLL of a secondary project. I changed some code in secondary project, built it and changed the DLL reference in the primary project to the updated DLL.
Now, in VS 2010, when I press F11 to try and debug the updated code from the secondary project, it shows the following error and takes me to the old code when I press OK.
This source file has changed. It no longer matches the version of the
file used to build the application being debugged.
I have tried Clean+Build, Rebuild, cleared temporary files etc. I checked the properties of the DLL and its path points to the newer version(updated code). But the problem still persists.
In short, VS is completely ignoring the new code. Any clues how to resolve it?
I can add an image to a form no problem, and it builds with no errors. Then, when I relocate the project, there is the error 'does not support code parsing or generation because it is not contained within a project that supports code' when I reopen the project from the new file location. This can be resolved by removing the form and adding it again, however this would have to be done every time the project is opened after being moved, and for anyone trying to open it from a new location.
I've tried adding the image in various ways, and I've tried adding different images. Every time, images are added with no issues in the original project location, however as soon as the project is moved this error keeps occurring.
How can I add an image to a C# project in Visual Studio 2019 while retaining the ability to move the project to a different location without resulting in errors whenever the project is reopened?
*EDIT I'm now wondering if this occurs after a certain amount of time that the project is copied, instead of because of adding an image. I have started to get the error again after I have copied the project about 10 times, which is around when I started to get the error when I was working with an image included in the project.
**EDIT I have rephrased the question here: After I have copied a C# project in Visual Studio 2019 about 10 times or so, I get an error when I reopen the project
Remove Special characters from Project folder Name.
Amend Project file paths in solution File.
Delete .vs Hidden folder or .sou file
I recently had a similar experience where i would get the error when trying to open the designer in VS after i moved my project.
to give some context i moved a project from TFS to GIT source control. I created a project in azure devops and the project name contained a space.
the clone url then escaped the space character as %20, when Cloning this repository from the command line without renaming the destination folder I ended up with a folder name containing %20 in its name, instead of a space. my solution file then had the same naming conventions containing the %20 in the project path.
This https://social.msdn.microsoft.com/Forums/en-US/cadde249-3fa9-46de-aa23-37ceae612e8c/form-not-contained-wiithin-a-project-that-supports-code?forum=winformsdesigner helped me:
Close the solution. go to the solution's file folder and delete the solution's .SUO files. Then reload the solution in Visual Studio. In the solution file explorer, right click on the targeted form source and select the "View code"(not "View Designer"). When the source file is opened, then right click over the source text and select View in designer.
I am trying to add Microsoft.CSharp and other system references to a c# class library in vs 2015 community edition bound to tfs. when i add it doesn't persist the path for this particular class library. All the references i add are highlighted in yellow !. The same references and paths I am able to add to other projects but not this current one I am facing an issue with.
I have created a new solution and tried. it still doesn't work.
However I would not want to create a new project file. Any suggestions or workarounds to solve this problem?
Your .csproj files might be "corrupted" somehow. I would create a new project file and then overwrite your existing project file so that it can be checked into TFS.
Create a new project and copy all of your source files into the folder. If you have folders use Visual Studio to re-create them. Use the show hidden button in Solution Explorer to show all the files. Now include the files by right clicking and selecting include in project (you can use Shift to select multiple files). Check your project properties and make sure you copy anything important.
I tried a few things-
I changed from community edition to professional edition 2015. the same problem persisted.
I created a new csproj file and added back the files manually. It got added fine.
However I am pulling the references from a nuget packages folder and updating. if we have the wrong path to the nuget packages, even though we add the references, they were being shown as not referenced.
The nuget packages needed to be correctly mapped or else VS2K15 acts weird.
So bottom line, because my nuget references were incorrect it was throwing these errors. I know This is very weird!!!
I have a solution consisting of a WPF app. After some juggling of dir paths I cannot add references to my projects anymore. Whenever I do "add reference" in visual studio 2013 I get an error:
Cannot locate resource 'shared/standardresources.xaml'
I can build the solution just fine in VS.
Due to company policy the structure of my solution is like this (note the src dir):
x.sln
src/wpfApp/wpfApp.csproj
However, it turns out I get the same problem even if I just create new project in the default place in a new solution. I can reproduce the problem as described above like this:
Create a blank solution
In Windows Explorer create a src directory in the solution
In VS, Add a new WPF Application to the solution. Store it underneath the src dir created previously.
Now try adding references to the WPF Application by right clicking it in Solution explorer. The error message appears.
Any help would be appreciated. Thanks.
To the noobs like myself out here you can try to move the projects into the new src folder and add the projects back into the solution. Also, verify you are using the absolute correct version of the dlls. Wrong versions can occur when setting up a new development machine. (Making certain the most current and correct libraries are on the new machine is one more reason to "image" a known good dev harddrive as a baseline.) Edit the project file and look at the references version="value" and compare to the installed components.
SOLVED! For people who are having the same problem this is what i did:
I moved the project away from where Visual Studio though it would be. This forces you to create a new project file there. I did. Then i restarted the program and now my project was visible. I now just moved the original project-files into the now visible folder.
I added an project to my solution but it doesn't show up next to all the other imported projects.
And since it doesn't i'm unable to delete it and try again.
However it can be seen if i right click the solution and go to "Startup Project", "Project Dependencies" or "Debug Source File".
I have searched the web for a while now but have yet to find someone with a similar sutiation, how do i solve this?
I imagine that this is because the files don't exist. Have you created the project on a network drive somewhere? Have you renamed or moved the folder after adding it to the solution?
Check the paths are right, then double check. Also check your version control to ensure someone hasn't wiped out your changes and left the .sln file intact.
You can edit the .sln directly I suspect to double-check the exact path it's looking for. Verify that path exists too.
Make sure the project you added was created in the same version of Visual Studio too.