I've downloaded .NET 5 according to these instructions.
I can build the Antiforgery.slnf in Visual Studio with no errors.
I've added it as a project reference in a different solution with an ASP.NET Core 5 app.
But I'm getting these errors:
'..\..\..\..\..\..\aspnetcore\src\Antiforgery\src\Microsoft.AspNetCore.Antiforgery.csproj' targets 'net6.0'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v5.0'. AntiForgeryTest C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 1662
NU1201 Project Microsoft.AspNetCore.Antiforgery is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Project Microsoft.AspNetCore.Antiforgery supports: net6.0 (.NETCoreApp,Version=v6.0) AntiForgeryTest C:\Users\Davidk\source\repos\AntiForgeryTest\WebApplication2\AntiforgeryTest.csproj 1
It seems as though the current version of ASP.NET Core source code in Github is version net6.0, and the current version available in Visual Studio when creating a new project is only net5.0.
Do I need to get version net5.0 of the source code? I'd prefer to not have to do that since it's taken me hours just to get the .NET Core source code to build.
Any recommendations would be greatly appreciated.
I'm using Visual Studio Enterprise 2019 version 16.8.2 and here is the list of the installed SDKs:
I have build this project as .Net standard project and i am facing this error issue in jenkins when I build this project:
C:\Users\tahab.jenkins\workspace\Mondaytest\Calculator\Calculator.csproj(1,1):
error MSB4041: The default XML namespace of the pr.oject 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
Make sure you use recent versions of the MSBuild task you use to build your project.
You need too use the Visual Studio 2017 (Build Tools, Full, ..) version of MSBuild - which is local to the Visual Studio installation - to build your project.
You may need to confiure the path to MSBuild, which would be - depending on the version installed on the build gent - similar to
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
This error happens if you try to build new projects with older versions of Visual Studio / MSBuild or even with the old version of MSBuild that is part of .NET Framework.
I have an ASP.NET Core 1.1.2 project targeting .NET Framework 4.6.2. I recently installed the latest version of Visual Studio (15.2 26430.16), and now I can't build the project using MSBuild version 15.1.1012.6693. The error occurs when using a PublishProfile.
The MSBuild command is:
msbuild D:\project\project.csproj /p:DeployOnBuild=true /p:PublishProfile=dist
And the error is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets(54,5):
error MSB4062: The "TransformWebConfig" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\..\..\tools\net46\\Microsoft.NET.Sdk.Publish.Tasks.dll.
Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\tools\net46\Microsoft.NET.Sdk.Publish.Tasks.dll' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
[D:\project\project.csproj]
It works when not specifying a publish profile. However when publishing the project from Visual Studio, everything works as expected.
This is known bug of the tooling when building using the 64 bit MSBuild version (build server, command line). See this GitHub issue for details.
Since this issue has been fixed, you need to upgrade to the recently released 15.3.* versions of Visual Studio / MSBuild and probably also 2.0.0 version of the .NET Core SDK.
I have a Visual Studio 2015 C++ project (solution) of which most build configurations use the VS2015 toolset. However, some configurations are set to use the VS2010 toolset because they link to 3rd party libraries built using VS2010.
All configurations build successfully from within the IDE, and the VS2015 configurations build successfully using MSBuild on the command line, but I am having trouble building the VS2010 configurations using MSBuild.
I invoke msbuild as follows:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
msbuild MSVC\mysln.sln /p:Configuration="myVS2010Config" /p:useenv=true
For the VS2010 configuration I get error:
error C2039: 'gets': is not a member of 'std'
which suggests that the VS2015 compiler is being invoked, not the VS2010 compiler.
Why isn't MSBuild invoking the VS2010 tools?
I have a CruiseControl .NET build server running on Windows Server 2003, and I am trying to build and publish my ClickOnce application using msbuild.
Everything is working fine, except when I enable the bootstrapper of my ClickOnce application. When this happens, I get the following error in the DeploymentGenerateBootstrapper target:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (3939,9):
error MSB3147:
Could not find required file 'setup.bin' in 'E:\Projects\src\TestProject\Engine'.
.NET Framework 3.5 SP1 and 4 and latest Windows SDK for both are installed on the server, but the bootstrapper folder in C:\Program Files\Microsoft SDKs\Windows\versionNo\ does not exist. I tried copying the files from my workstation machine with no luck.
I do not want to install Visual Studio on server and only install the necessary SDKs.
I have also tried copying the bootsrapper folder from my machine
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper
to build server but no luck.
Any ideas?
You will also have to add the associated key and value to the registry to allow MSBuild to find the path to the Bootstrapper folder. I can confirm that this has worked for me using the following regedit.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\GenericBootstrapper\4.0]
#="0"
"Path"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bootstrapper\\"
Update: According to Emma's TFS Blog it appears the following registry values are checked in order to find the bootstrapper path and if not found looks in your local project folder under the Engine sub folder and then bails with the MSB3147 error if not found there.
HKLM\Software\Microsoft\GenericBootstrapper\<.NET Tools Version>\
HKLM \Software\Microsoft.NetFramework\SDKInstallRoot\Bootstrapper
HKLM \Software\Microsoft\VisualStudio\\InstallDir\Bootstrapper
Reminder: Also remember that there is a 32-bit and a 64-bit registry so be sure to add this value to the same registry that your tools will be accessing.
In the meantime I've also created a feature request to get a more reasonable solution for this issue. Please vote on my feature request to get Microsoft to take a look at it.
BTW, here are a few more links about this issue:
http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/7672078f-f2bd-4142-b8a9-740c2a8a5ae7
http://social.msdn.microsoft.com/Forums/en/msbuild/thread/6964ba78-5b66-4cd1-bdd1-b31edb76b96a
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/97ac8717-daf7-4554-8dfa-8a63da47a17d
MSBuild: error MSB3147: Could not find required file 'setup.bin'
https://connect.microsoft.com/VisualStudio/feedback/details/361924/remove-bootstrapper-from-microsoft-sdks-directory
http://blogs.msdn.com/b/emmamou/archive/2009/04/08/team-build-for-clickonce-application-with-bootstrapper.aspx?CommentPosted=true#commentmessage
You can also pass the location of the bootstrapper packages to the common Publish target like this:
<PropertyGroup>
<BootstrapperSdkPath>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper</BootstrapperSdkPath>
</PropertyGroup>
and then
<Target Name="Publish">
<MSBuild Targets="publish" ... Properties="GenerateBootstrapperSdkPath=$(BootstrapperSdkPath); ..."/>
</Target>
I struggled with the same problem on my win7 x64 machine. I have not installed Visual Studio and tried to build and publish a .NET 4.5 WPF solution. I had to add the following keys to the registry
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\GenericBootstrapper\11.0]
"Path"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\Bootstrapper\\"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\GenericBootstrapper\4.0]
"Path"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\Bootstrapper\\"
You also need to copy the Bootstrapper folders from your dev machine. This blogpost directed me in the right direction http://www.wiktorzychla.com/2013/11/msb3147-could-not-find-required-file-on.html
I had a similar issue to this but in my case I do have Visual Studio installed on the box, and publishing from Visual Studio works fine.
When publishing from the command line with msbuild.exe, the build failed with aforementioned error "MSB3147 Could not find required file 'setup.bin'".
The solution was to explicitly specify what version of Visual Studio to use during build.
<MSBuild
Projects="MyProject.csproj"
Targets="publish"
Properties="Configuration=Release;PublishUrl=C:\AnyFolder;VisualStudioVersion=12.0"/>
I have Visual Studio 2013 on a Win7 x64 machine. My reading of the problem is that MSBuild was looking in the wrong place in the registry. By explicitly telling MS Build to use VS 12.0, it picked the correct registry location entry and consequently the correct path to BootstrapperSdkPath.
I was able to fix this problem by pointing to MSBuild.exe from this location
C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe
Previously I was pointing to
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
Hi I know this answer its soooooo late but just in case
I had to add the Path prop to the task, with the Path where the bootstrapper its located, in my case I used Visual Studio 2015 so the Path is:
**Program Files(x86)\Microsoft Visual Studio 14.0\SDK\Boostrapper**
MSBuild has a Task GenerateBootstrapper in my case
<GenerateBootstrapper>
AplicationFile="$(AppName)"
ApplicationName=..
ApplicationUrl=..
BootstrapperItems=..
Culture=..
ApplicationUrl=..
Path="Program Files(x86)\Microsoft Visual Studio 14.0\SDK\Boostrapper\"
</GenerateBootstrapper>
with this the MSBuild is able to recognize and generate the file
Now i'm stucked with the .net 4 bootstrapper but guess is another story...
I experienced this same error via my TeamCity build server. The cause in my case was that I was running an MSBuild task against my .sln file, with a 'MyProject:publish' target. In this case, the solution+projecth had been updated to target .NET v4.5, but the build server was still configured to use MSBuild Tools 4.0 and .NET v4.0.
Took me a little while to work out the inconsistency between working and non-working branch builds.
I added this line to script. It helped.
call "%VS120COMNTOOLS%vsvars32.bat"
Visual Studio 2013, SDK v8.1A.
Just struggled with this myself - I chose to commit the bootstrapper files to source control. It is possible to override the path to bootstrappers, just provide /p:GenerateBootstrapperSdkPath=.build\Bootstrapper
Then no need to modify registry - and the added benefit that the build is now self-contained.
Only "problem" is that I have to manually copy the Bootstrapper files into source control. In my case (VStudio2015), this meant copying the files from C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper