I had to format my computer, reinstall all Visual Studio and Xamarin stuff , but after that, my old projects and new ones throws this error:
The imported project "C:\Program Files (x86)\Windows Kits\10\bin\10.0.14393.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets
I can't even understand this error, or find anything in Google. The first file address is different than the second, it doesn't make sense. The second one, is the actual one in my UWP.csproj and it is in my drive at this location. The first file address I have no idea where it's coming from and it's not in my drive. The 10.0.14393.0 folder doesn't exist in my drive.
Any idea how to understand this problem and fix it?
Thanks
EDIT:
After formatting my computer again and reinstalling the entire Visual Studio/Xamarin suite, I verified that both paths exists in my computer. I wonder what happened.
Right click .csproj file on the Solution Explorer that is SampleProject(load failed) then right click select Edit Solution. Once you got there then find TargetPlatformVersion tags, it also has decimal value like this 10.1.17882.0 blablabla something like that... Then Open folder C:\Program Files (x86)\Windows Kits\10\bin you will see version SDK folders there, then copy FOLDER NAME of the latest version SDK folder and PASTE or replace value 10.1.17882.0 in TargetPlatformVersion tags SAME with TargetPlatformMinVersion tags but lower version of SDK on the .csproj file. Right click and reload project cheers!
Related
I'm trying to run a Unit Test project in Visual Studio (.NET Framework 4.72).
The project is now building/running successfully, however there is still an error that the NuGet packages can't be restored (the file path is actually wrong and does not exist.). How can I change to the right file path and tell VS to not look in the wrong path?
Here's the error:
NuGet Package restore failed for project Tests_WeatherData: Could not find a part of the path 'C:......\Begin\packages\MSTest.TestAdapter.1.3.2\build/_common/zh-Hans/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll'
Thank you for any advice how to change the file path/restoring settings.
It can be caused by having your project located within a subfolder that is too deeply nested. I think possibly there's some limit for the folder path like maybe 250 characters or something like that.
I saw the same error when I downloaded a zip with some demo projects and when I unzipped it created a folder with many subfolders. The project I was interested in was down pretty deep in the subfolders and when I tried to restore its NuGet packages I got the same errors.
I moved the project folder up nearer to c:\ and then the restore errors went away.
This is what worked for me.
Download nuget.exe from here.
Copy this nuget.exe executable to the folder that contains the solution which is currently failing to build.
Ensure that the LongPathsEnabled registry key is set to 1.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled
Open cmd prompt, navigate to the above folder location. Run the below command.
c:\repos\MySolutionFolder>nuget.exe restore
Build the solution in Visual Studio. In my case I used VS2019.
Link that helped me with these steps - Github-Issue.
The issue could be filepaths in your CSPROJ file. Most common cause is project restructure and the location of packages has changed.
In addition to NUGET references in the CSPROJ, there could be a few other spots in the footer of the CSPROJ or the header portion for MSTest adapter entries. I.e. just verify all your filepaths (especially relative) ones are all correct and reload/rebuild.
Following on from my issues with a simple Visual Studio Installer Package, I'm making the switch to WiX. The learning curve is annoying, because once I've set this up I'm going to forget how it works before I need to do it again next project. But anyway, here we go.
My environment is Visual Studio 2019 and Azure DevOps (the full TFVC). The projects involved are class libraries and a WPF application all written in C#. I also have the WiXWax extension thingy to give me a GUI for adding projects and dependencies quickly.
When I created my WiX project I stupidly included a typo in the name of the project and consequently in the underlying folders. When I noticed this I decided to fix it;
Unload the projects
Using the source control explorer, rename the folder
Using notepad, open the sln file and correcting the path to the project, and the project name
Using notepad, open the project file and correct its references to the path and project name
Rename the project files
As you can see I have changed every reference to the the incorrect spelling.
Unfortunately, Visual Studio won't load the project. I get an error telling me this:
C:(correctly spelled path that matches the file system and file names).wixproj
: error : The project file
'C:(path with a typo in it)(correctly spelled project name).wixproj'
has been moved, renamed or is not on your computer.
Now the message is partly correct, because the file it says has been moved or renamed has in fact been renamed. If I click on the error it opens the wixproj file (it's just an xml of course). This file doesn't have a self referenced location though, the only things that's close is the include to the projects which haven't changed and are correct (..<correct detals>.csproj)
I have opened every xml file including the solution files and wix project files and none of them contain the typo (Ctrl+F, case insensitive, not whole word - no results).
I have tried "Removing" the WiX project from the solution and re-adding it, but I get the same error and it doesn't add it to the solution file.
What is remembering the old path name, and how can I make it forget it?
edit: I've also tried Ctrl+Shift+F per Klaus' suggestion and it finds no references.
I had a C# class library project as part of my solution. I later updated the root folder of the project. Since the solution was pointing to the wrong path, I had to "delete" the project and then re-add it.
However, when I add the existing project, it says "The project file \myproject.csproj' has been moved, renamed or is not on your computer".
This is baffling because the .sln file has no reference to the project. (I checked the text contents)
How does VS cache the project with it's old folder path? The solution is version controlled in TFS, but the mappings point to the new folder structure, so it's even more confusing as to where it's trying to get the old folder path from.
Edit: I checked the .csproj file, the .csproj.vspscc and none of them have a path variable in them.
I have also tried deleting the .suo file.
This has been a trouble with Visual Studio for years now. In such a case, deleting the hidden .suo file in the root folder and restart VS will reconstruct a proper .suo file and almost always eliminate the issue.
If you use TFS, take a look at Just TFS' comment in the original post to avoid this problem in the future.
I am using the current version of anksvn. I can add a C# 2008 console application successfully to subversion. I can also download the C# 2008 code to my workstation as a working copy. However the problem is the application does not compile clean. I am getting the error message, "missing directive or an assembly reference" on alot of the members.
I know there has to be some kind of a problem when I add this soltuion to
anksvn. Note: I can load all the other soltuion files to anksvn and I do not
have problems.
What is occuring is the 3 other project files that I am working with are at
the same directory level where the solution file is located at. One of the 3
project files that I am referring to has its own visual studio 2008 solution also.
I believe most other solution files have their project files in a directory
path level that is lower than the solution file.
One thing I have tried was to open up the solution file and change the
directory paths where the 3 files are located at. This did not help.
Thus can you tell what I can do when I check in this file to anksvn, so that it
will compile clean once I have checked it oout of anksvn?
I have an annoying error that's been popping up, and I don't know where it is coming from. The error is:
Error 31 Unable to copy file "app.config" to "bin\Debug\Framework.Tests.dll.config". Could not find file 'app.config'. Framework.Tests
The problem is, I don't have a bin\Debug folder anywhere, and it does not say from where it is trying to copy app.config. Double clicking on the error doesn't bring me to any code where it is trying to copy, so that doesn't help me either. So I don't know where I should make the app.config.
How can I find this out?
You have added a reference to a file called app.config or Visual Studio did this for you. The file does not exist on the disk, presumably because after adding the reference you later deleted the file.
Search for the missing file in your Solution Explorer, and either delete the reference or create the file.
It is most likely in the root folder of one of your projects, and should have a yellow triangle warning icon showing that the file is missing.
In an MSTest project the app.config is the one that you would like to provide any calls to the ConfigurationManager class.
It resides in the root of your test project.
The bin\debug folders will be created once the project compiles for the first time. Show all files in the solution explorer should help as they are not (and should not) be included in the project.
HTH
You probably do have a bin\Debug folder beneath your project folder, being the build target folder created by Visual Studio when you build your project for the Debug configuration.
My guess is that something (a test framework perhaps) still has the DLL file loaded, so Visual Studio can't delete and replace the existing Framework.Tests.dll.config file with the contents of your app.config. [Note: the project build action for app.config files is to copy it to the target folder renamed to match the executable with an extension of .config appended.]