Failure Could not find file ...App.g.i.cs - visual-studio

I'd like to stop this error appearing in the Intellisense section in the Output window in Visual Studio:
[Failure] Could not find file 'C:\code\CatApp\obj\x86\Debug\App.g.i.cs'.
I've cleared obj and bin folders, upgraded to the latest version of Visual Studio 2017,cleared all nuget packages and checked my project out from SVN again.
I get the same problem if I create a new UWP project. (Every time I create a new UWP project, I have to get the Nuget package Microsoft.NETCore.UniversalWindowsPlatform separately. I'm wondering if the two problems could be related.)
My target and min version are 16299.

Related

Error publishing .NET MAUI project: the target "_GenerateAppxPackage" does not exist

I have a .NET MAUI project that was created with VS2022 Preview 2, and it builds without errors or warnings and works as expected in the debugger. Prior to updating Visual Studio to Version 17.4.0 Preview 4.0 I was able to publish the project as a sideloadable MSIX from within VS.
Since updating, I get the following error when I click Create in the Create App Packages wizard:
MSB4057 The target "_GenerateAppxPackage" does not exist in the project.
The error is listed against the MAUI project's .csproj file.
I've tried creating a separate new, default MAUI project in the new preview - this publishes ok and (as far as I can see) doesn't contain _GenerateAppxPackage anywhere within its files or project structure. So for now I'm assuming this isn't something new that was added with the preview.
I found some references to _GenerateAppxPackage on the web but they appear to refer to Azure integration. My project is a stand-alone data transformation app that doesn't even access the net.
I'm at a loss what to try next. I don't know what this target refers to, where it should "exist" within the project, or what it does. Can anyone help me understand the problem and/or point me to a solution?
Update: 2022-10-28:
I tried deleting the project structure and creating it from scratch with File -> New Project, then adding back only the .cs and .xaml files. Publishing the recreated project gives me the same error.
I also tried uninstalling the VS preview and re-downloading and installing it. Again, publishing the project gives me the same error.
I still have no idea what is causing this, or even where to start looking.
I faced with the same problem at Visual Studio 2022 17.4.0 (net6.0-windows10.0.19041.0).
The simplest solution for me was be using the command dotnet publish directly.
At root of project just write in terminal:
dotnet publish -f net6.0-windows10.0.19041.0 -c /p:RuntimeIdentifierOverride=win10-x64
I learned today that MAUI is now in the mainline Visual Studio 2022 edition, I've tried using that instead of the preview, and I can confirm that the problem goes away. I wish I'd known about this earlier...

Visual Studio Could not find a part of the path system.net.http while checking in to TFS

I have a solution that compiles and runs fine. However when trying to check it in to TFS I get the error :
"Could not find a part of the path C:\pathToMyProjects\MyProject\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll".
I recently installed Visual Studio 2017 while the project was last checked in to TFS while being built in Visual Studio 2015 if that has anything to do with it.
I've removed System.Net.Http from references and Nuget packages. Even when all are uninstalled I get the same error. Any clues as to how I can figure out what the real issue is?
The error you have is mainly caused when you're trying to check in files which is no longer exist on the machine.
This will happen when TFS has some changes staged that no longer exist
on the file system. For instance, if you add some files in Visual
Studio (which adds them to the changes list), delete them directly
from the file system, then attempt to check in the changes, it will
complain that it could not find the file(s).
Just try below things to narrow down the issue:
Check if the file exists under the the specific path mentioned in the
error message.
Go to Source Control Explorer -> select these nonexistent files
-> Undo Pending Changes. Or you can just left these files in the Excluded Changes list to not check in them.
Re-install/upgrade Nuget packages in Package Manager Console:
PM > update-package System.Net.Http -r
Uninstall the System.Net.Http Nuget packages and remove the reference, then reinstall the System.Net.Http Nuget packages and add the reference again.
Clean and rebuild your whole solution, once that compiles and runs
fine locally, then try to check in the changes again.
Check if this issue also occurs on other VS machines, so we could
know that whether it is related to the VS Environment or others.

the target "UpdateDesignTimeXaml" does not exit in the project error in Xamarin Studio

I am new to mobile application developing. When I was creating a new .xaml file in new solution in the Xamarin Studio.
It gave the error:
"the target "UpdateDesignTimeXaml" does not exit".
How can I resolve this problem?
Build errors can occur if you have updated the Xamarin.Forms nuget to a newer version that requires UpdateDesignTimeXaml.
Close and reopen Xamarin Studio.
Clean all and ReBuild your project.
Ref: https://forums.xamarin.com/discussion/49152/problem-initializecomponent-and-pcl
A workaround for this is to remove the MSBuild:UpdateDesignTimeXaml from the Custom Tool of the xaml file properties in VS. Save, add MSBuild:UpdateDesignTimeXaml again and save again will force MSBuild to recreate the *g.cs file.
I had this with Visual Studio for Mac.
I fixed it by:
closing VS
manually deleting the packages, bin and obj folders
restart the project in VS
restore NuGet packages, build and run.
Got same issue in Visual Studio for Mac. Worked find with
closing VS
manually deleting the packages, bin and obj folders in both android folder and main folder
restart the project in VS
restore NuGet packages, build and run.

Creation of Release Build Failed in UWP

I am trying to build a UWP project in Release. But i am not able to create the build and I am getting an error could not copy the file "C:\Users\kumara krishnan\.nuget\packages\System.Private.Uri\4.0.0\runtimes\win8-aot\lib\netcore50\System.Private.Uri.dll" because it was not found. Also I am able to build and deploy when i keep it in debug mode. How to fix this issue?
It seems there is something wrong with your .nuget environment. You can try following steps to fix it.
Firstly delete the whole System.Private.Uri folder under C:\Users\kumara krishnan\.nuget\packages\.
Then in Visual Studio, open the Visual Studio Options dialog, click on the "NuGet Package Manager" node and make sure you have checked "Allow NuGet to download missing packages" and "Automatically check for missing package during build in Visual Studio".
After this, you can just rebuild your project and Visual Studio will automatically restore the NuGet packages your project used and download whole "System.Private.Uri" files.
You can also create a blank app and create a new instance of Uri without adding other references manually to check your environment.

Visual Studio Online - Get Latest and NuGet

It's very possible that I'm missing something simple because I can't find others on the internet experiencing the same thing.
I'm a team that's new to the use of TFS and Visual Studio Online and we're encountering this problem:
(Using Visual Studio 2015 & 2013)
I used NuGet to add Microsoft.AspNet.WebApi.Cors to my newly created WebAPI project (ditto all other NuGet packages)
Did my work and checked in a building solution in to VSO
Co-worker did a Get Latest
His newly-retrieved project won't build and, when we expand the References, the assemblies are marked with a yellow warning icon, indicating that they're missing
We've tried (from the context of the failing project):
Update-Package
Update-Package -reinstall
Manually uninstalling and reinstalling the package in the NuGet UI
Manually adding the entire contents of the Packages directory in to TFS and doing a get latest on that directory as well
Wiping the solution out from his local file system and pulling it down clean
Copying the contents of my {Solution Directory}\Packages to a USB drive, walking it to my co-worker's computer, and copying it to his machine
Only item #6 worked but I'm CERTAIN that this cannot be the right answer.
I guarantee that this is worthy of a dope-slap but what might I be missing?
Thank you to jessehouwing for reminding me that this topic is still out here. He's exactly right on. We removed the Packages folder from source control and that resolved the problem completely.

Resources