How to solve rzc generate exited code 1 error - asp.net-mvc

When i pulled code from team explorer in visual studio code . Rzc generate exited code 1 error occured. I am unable to build project.how to solve this error?
Target framework .net core 3.1

Open the Project in visual studio-> check in views folder for any files having X - red color symbol then remove that file from visual studio.
Previously you deleted the files from folder - that is the issue.
ie, Razor Engine trying to render those files, but the engine could not find the physical location of that file, that is the problem. Always delete the unwanted files using the visual studio or any project editor. That is the best practice.

I solved rzc generate exited with code 1 microsoft.net.sdk.razor.codegeneration.targets
by undoing the changes that deleted a project from the folder in file explorer instead of visual studio.

In your Project.csproj, you should have a piece of XML code like this:
<ItemGroup>
<Folder Include="Controllers\" />
<Folder Include="Views\Home\" />
<Folder Include="Views\Shared\" />
</ItemGroup>
It depends on your folder structure.

In case you are using Windows 7 and getting the 'rzc generate exited with code -2147450750' while debugging a .NET Core app, try installing the standalone package: Microsoft Update Catalog - KB4457144.
I had the exact same error message (apart from the directories) on Windows 7 with a newer VC++ distribution already present.
The package contains the KB2533623 that we want. Details of KB4457144: September 11, 2018—KB4457144 (Monthly Rollup)
After installation and a reboot, dotnet new console goes through without an error.
Dell forum source: Microsoft Windows 7 Update KB2533623 needed to install Dell Update Package (DUP)

You are using visual studio 2019 older version then you have updated to the latest version has fixed my issue.

Yes. I have delete some files manually from folder.
So i resolved that issue by deleting the unloaded files from that deleted folder as
red cross files will be still in our visual studio if we delete
them outside.

Related

The default XML namespace of the project must be the MSBuild XML namespace

I cloned the ASP.NET Core SignalR Repo locally, and try opening the solution from within the following environment.
IDE
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01055
DOT NET CLI
λ dotnet --info
.NET Command Line Tools (1.0.0-preview2-1-003177)
Product Information:
Version: 1.0.0-preview2-1-003177
Commit SHA-1 hash: a2df9c2576
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
I end up seeing a lot of these kinds of error messages:
..\Repos\SignalR\src\Microsoft.AspNetCore.SignalR\Microsoft.AspNetCore.SignalR.csproj
: error : The default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 2003
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the project has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format. ..\Repos\SignalR\src\Microsoft.AspNetCore.SignalR\Microsoft.AspNetCore.SignalR.csproj
I want to know how to fix this the correct way.
The projects you are trying to open are in the new .NET Core csproj format. This means you need to use Visual Studio 2017 which supports this new format.
For a little bit of history, initially .NET Core used project.json instead of *.csproj. However, after some considerable internal deliberation at Microsoft, they decided to go back to csproj but with a much cleaner and updated format. However, this new format is only supported in VS2017.
If you want to open the projects but don't want to wait until March 7th for the official VS2017 release, you could use Visual Studio Code instead.
I ran into this issue while opening the Service Fabric GettingStartedApplication in Visual Studio 2015. The original solution was built on .NET Core in VS 2017 and I got the same error when opening in 2015.
Here are the steps I followed to resolve the issue.
Right click on (load Failed) project and edit in visual studio.
Saw the following line in the Project tag: <Project Sdk="Microsoft.NET.Sdk.Web" >
Followed the instruction shown in the error message to add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to this tag
It should now look like:
<Project Sdk="Microsoft.NET.Sdk.Web" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Reloading the project gave me the next error (yours may be different based on what is included in your project)
Saw that None element had an update attribute as below:
<None Update="wwwroot\**\*;Views\**\*;Areas\**\Views">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
Commented that out as below.
<!--<None Update="wwwroot\**\*;Views\**\*;Areas\**\Views">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>-->
Onto the next error: Version in Package Reference is unrecognized
Saw that Version is there in csproj xml as below (Additional PackageReference lines removed for brevity)
Stripped the Version attribute
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" />
I now get the following:
Bingo! The visual Studio One-way upgrade kicked in! Let VS do the magic!
The Project loaded but with reference lib errors.
Fixed the reference lib errors individually, by removing and replacing in NuGet to get the project working!
Hope this helps another code traveler :-D
#DavidG's answer is correct, but I would like to add that if you're building from the command line, the equivalent solution is to make sure that you're using the appropriate version of msbuild (in this particular case, it needs to be version 15).
Run msbuild -version to see which version you're using or where msbuild to check which location the environment takes the executable from and update (or point to the right location of) the tools if necessary.
Download the latest MSBuild tool from here.
If getting this error trying to build .Net Core 2.0 app on VSTS then ensure your build definition is using the Hosted VS2017 Agent queue.
I was getting the same messages while I was running just msbuild from powershell.
dotnet msbuild "./project.csproj" worked for me.
if the project is not a big ,
1- change the name of folder project
2- make a new project with the same project (before renaming)
3- add existing files from the old project to the new project (totally same , same folders , same names , ...)
4- open the the new project file (as xml ) and the old project
5- copy the new project file (xml content ) and paste it in the old project file
6- delete the old project
7- rename the old folder project to old name
I had the same problem and solved it by using dotnet instead of msbuild.

Visual Studio 2015 Nuget Restore Problems for Version 1.0.3 of Newtonsoft.Json.dll

I have a solution which was working with Visual Studio 2015 Community in a machine. That machine was crashed and I can not access the source codes over there any more.
However the source codes were checked into TFS. After I got new machine, I got all latest source codes from TFS.
The issue is that this solution in new machine has a lot of compile errors.
Visual Studio 2015 could restore some of the references. However I have a complain like this -
Clicking button Restore will have this error -
I don't think I have used a version of 1.0.3 of Newtonsoft.Json.dll directly. I deleted the package folder and all project bin and obj folders. The recompile still can not fix it.
What can be done to fix this problem?
Have you also delete the NuGet.Config file in the packages folder? If you did it, Visual Studio will try to do the MSBuild package restore instead of Automatic Package Restore.
By default, the NuGet.Config file instructs NuGet to bypass adding
package binaries to source control. Automatic Package Restore will
honor this as long as you leave this file in place. Note that
NuGet.Config only has an effect when using Visual Studio to integrate
with Team Foundation Server (TFS).
You should also manually remove references in all your projects to the Nuget.targets file. The following article outlines in more details: https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore
If you still can't fix it, try to use the Command-Line Package Restore

Error: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found

I have migrated a VS2008 solution to VS2013. My solution contains VC++ projets.
I have set the tools platform to v120_xp for each project
My solution compile on my computer and compile on my builds server in VS2013
My builds server is a Windows2008 R2 with VS2008, VS2010 and VS2013 and a build controler of TeamFoundationServer 2010.
When i launch the build with the build controller, the build fails with :
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
In the V110 directory this file doesn't exist but it exist in the V120 directory.
I have checked the registry :
HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersion\12.0
the VCTargetPath are corrects
Have you an idea to help me?
I have edited the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0\11.0
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0\11.0
to use the V120 directory
Now my server build the solution, but i don't understand why MSBuild use the key
ToolsVersions\12.0\11.0 and not the key ToolsVersions\12.0\12.0
Parhaps it's due to the v120_xp platform toolset
The true answer is that MSBuild subtracts 1 from the .sln Visual Studio Version. Since you do not have VS 2012 install or you have not installed it, the v11.0 folder is not found. It is all explained by Sayed Ibrahim Hashimi:
http://sedodream.com/PermaLink%2cguid%2ca5894bad-f2a1-441a-a5b2-74f16c6cf8aa.aspx
I came across the same problem in 2015 though, with Windows 10 and Visual Studio 2015 RC (fresh install)
To correct the issue I tried several solutions based on my research ie installing "VS Windows SDK" which didn't do anything different to resolve my problem, I then on another recommendation installed GitHub in order to download MSBuild which is now excluded from VS, I ultimately downloaded and installed "VS Tools for Windows 10" this didn't give me the same error in the end, without having to change registry keys
Installing VS 2012 on your build server should create the necessary targets files for you.
I was able to get past this by changing $(VCTargetsPath) to $(VCTargetsPath12) in the project file.
This feels like a temporary workaround rather than a permanent solution, since once we move to the next version of Visual Studio we'll have to find all the references to $(VCTargetsPath12) and replace with the new target path.

Problems building a simple F# project in Xamarin Studio on Windows 8

I've had VS2013 installed on my windows 8 laptop and F# works fine.
I've since installed Xamarin Studio version 4.2.2 but unfortunately can't get any F# project to build even a very simple one.
I installed F# Version 3.0 from the Web Installer and have installed the F# addin in Xamarin Studio and restarted it. Compiling the simple Console Project just gives me the error:
Error: Build failed. See the build log for details.
With no other details anywhere.
In the fsproj file There is the following:
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets"
I'm not sure where the MSBuildExtensionPath32 is set or where it currently points to but if I update this to a hard-coded path that actually points at my file:
<Import Project="C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
Then when I build the project in xamarin it builds successfully.
Is there an easy way of setting the MSBuildExtensionsPath32 to my actual path for xamarin? I don't really want to resort to having to set up a .bat file to launch it but can't find an option in xamarin to configure it.
I feel I must be missing something.
Thanks
It looks like the F# project templates are using a path to an older version of F#. There is a discussion about this on the GitHub repository for the F# addin. Hopefully the project template can be updated to support different versions of F# being installed. For now you can modify your project file.
MSBuildExtensionsPath32 points to C:\Program Files (x86)\MSBuild
So you could try modifying the project template to use the following path, which should work on your machine:
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />

Reinstall Microsoft Visual Studio Asp.net MVC 5 Scaffolding extension

I hade a problem with scaffolding in Asp.Net MVC 5 and Visual studio 2013
I tried to reinstall the extension "Microsoft Visual Studio Asp.net MVC 5 Scaffolding" by first uninstalled it. But I cant find any way to install it again.
I tried to repair visual studio. - no luck
I tried to uninstall visual studio and install visual studio, but the extension is still missing
Do I have to reinstall the PC or is there a quick fix?
I wanted to add to Chrille's answer.
The PendingDeletes can be found in
HKEY_USERS\<SID>\Software\Microsoft\VisualStudio\12.0Exp\ExtensionManager
And
HKEY_USERS\<SID>\Software\Microsoft\VisualStudio\12.0\ExtensionManager
And I found the AppData in my local and Roaming app data.
Here's what I did. It was a bit more involved than what everyone else was reporting. I tried doing a repair in the Control Panel, it ran for several hours and then failed. Perhaps my problems were that I installed VS2013 sp1 and then upgraded it to SP4 before I removed "Microsoft Visual Studio Asp.net MVC 5 Scaffolding."
I downloaded and installed Visual Studio Premium with Update 4 and then did a repair using that file, but the extension was still missing. I then found the AspNetWebFrameworksTools_VS12_ENU.msi in the en_visual_studio_premium_2013_with_update_4_x86_dvd_5935086.iso and did an uninstall and a reinstall, but the extension was still missing.
I extracted the packages\WPT\AspNetWebFrameworksTools_VS12_ENU.msi file from my .iso file using msiexec. In order to get the .msi file to extract successfully, I also had to place the *.cab files from \packages\WPT into the same folder I was extracting the .msi from. Once I'd extracted my msi file, I went into it's folder structure and found the Scaffolding stuff. It was in Dest\Microsoft ASP.NET\ASP.NET Web Stack 5\VS_12_COMMON7_IDE\Extensions\Microsoft\Web\Mvc\Scaffolding folder.
Once I had that, I still didn't have a .vsix file that I could install into Visual Studio. So what I did was create my own .vsix file. I did a little research on the web and created a file called [Content_Types].xml, it's literally called that. I renamed the file extension on several .vsix files that I had downloaded on my system to .zip and looked inside them to see what the contents of my [Content_Types].xml should look like, here's what I came up with:
<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="dll" ContentType="application/octet-stream" />
<Default Extension="pkgdef" ContentType="text/plain" />
<Default Extension="vsixmanifest" ContentType="text/xml" />
<Default Extension="txt" ContentType="text/plain" />
</Types>
I then zipped up [Content_Types].xml, extension.vsixmanifest, and Microsoft.AspNet.Scaffolding.Mvc.5.0.dll to a zip file called Microsoft.AspNet.Scaffolding.Mvc.5.0.zip. I then renamed that .zip file to Microsoft.AspNet.Scaffolding.Mvc.5.0.vsix. I then was able to install the extension using this .vsix file that I created.
I found that uninstall the AspNetWebFrameworksTools_VS12_ENU.msi in the vs2013 ISO. And install it.
So here's what I did...
1) I uninstalled the scaffolding through Visual Studio.
2) Deleted the registry from:
HKEY_USERS\<SID>\Software\Microsoft\VisualStudio\12.0\ExtensionManager\PendingDeletes
3) Went to Control Panel > Programs
4) Select Microsoft Visual Studio Ultimate 2013 > Hit Change
5) Choose Repair.
Pretty simple, but a little time consuming
Fixed it by deleting pendling delete in the registy + deleted AppData for Visual studio
AppData will be recreated at startup of vs
Have 7zip installed.
Download the full iso of visual studio.
extract the iso to a folder.
Go to \packages\WPT within that folder.
Run AspNetWebFrameworksTools_VS12_ENU.msi
Uninstall.
Run AspNetWebFrameworksTools_VS12_ENU.msi
Install.
That should do it.
To verify, create a new MVC project, and try to add a scaffold item. Don't verify with an existing project, because that may be a whole different problem.
I was missing the MVC controllers in scaffolding (only able to select Web API 2), then after removing MVC 5 scaffolding to reinstall I could not get it installed again.
I found downloading the .iso for VS 2013 update 4, extracting to a folder, then running AspNetWebFrameworksTools_VS12_ENU.msi to uninstall, then again to reinstall, then rebooting resolved both issues. I am now able to add controller, and I have MVC 5 controllers to choose from.
What worked for me was to remove the Registry keys, the AppData and the folder in this location C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions. After this, I repaired the VisualStudio from Programs and Features in control panel. I was desperate because even I uninstalled and re-installed again and the extension was not visible.

Resources