All Questions
527
questions
184
votes
7
answers
215k
views
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
...
175
votes
6
answers
110k
views
How do I get .NET Core projects to copy NuGet references to the build output?
I'm trying to write a plugin system with .NET Core, and one of my requirements are to be able to distribute the plugin DLL along with its dependencies to the user for install.
However, I can't figure ...
127
votes
24
answers
175k
views
MSBUILD throws error: The SDK 'Microsoft.NET.Sdk' specified could not be found
I'm trying to build a solution using msbuild command line and I keep getting this error:
error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
The version of msbuild is the latest ...
108
votes
4
answers
68k
views
How do you multi-target a .NET Core class library with csproj?
When .NET Core still used the project.json format, you could build a class library targeting multiple frameworks (e.g. net451, netcoreapp1.0).
Now that the official project format is csproj using ...
96
votes
4
answers
58k
views
Package version is always 1.0.0 with dotnet pack
TLDR: Where is dotnet pack pulling the version information when it creates the nuget package for an assembly?
I have a library, that I had transitioned from a .NET 4.6.1 project to a .NET Core ...
94
votes
5
answers
12k
views
Can files be nested in VS2017 Solution Explorer for .NET Core (non-ASP.NET Core) projects?
In "old school" MSBuild projects - as still used by Windows Forms in VS2017 for example - files could be "nested" via a DependentUpon item in the csproj file.
I used this to group unit tests together ...
82
votes
5
answers
63k
views
How do I exclude files/folders from a .NET Core/Standard project?
In .NET Core and .NET Standard projects, if you put files and folders within the project directory, they are automatically picked up by Visual Studio; essentially they are part of the project.
What ...
54
votes
4
answers
102k
views
The current .NET SDK does not support targeting .NET Core 3.0 | 3.1 | 5.0 | 6.0
I've just downloaded the release version of .NET Core 3.0.100
It was installed alongside older version that I have:
When I try to run dotnet restore for a project that targets .NET Core 3 (<...
52
votes
1
answer
20k
views
What are the differences between Microsoft.NET.Sdk and Microsoft.NET.Sdk.Web
I have a solution with two host projects (one is a Web Host and the other is a Generic Host) and a class library project referenced by those two host projects.
In the Sdk attribute of the root tag &...
44
votes
1
answer
16k
views
Setting custom <OutputPath> in .NET Core (stop adding framework target)? [duplicate]
In traditional .NET applications, it was possible to set a custom <OutputPath> of an assembly in the .csproj file (or via the project properties dialog). A path of e.g. bin\$(Configuration)\$(...
41
votes
3
answers
47k
views
How to access artifacts folder after build in TFS online?
PreInfo: I have .net core web api (vs2015) mixed with just ordinary projects.
I have spent almost 2 days now to get this to work and search and tried everything I can think of, but I just cant for ...
39
votes
12
answers
89k
views
Could not load file or assembly Microsoft.Extensions.Logging.Abstractions
I'm using VS2019 Pro v16.3.5
I have a solution containing an Azure functions project which references several class library projects.
The top-level project fails to compile with the following error:...
36
votes
1
answer
12k
views
Where is full documentation about the csproj format for .net core?
Is there a full documentation about the csproj format for .net core projects?
I was looking for a way to copy files before building.
After some searching I found a solution, but I can't find the ...
33
votes
3
answers
26k
views
How to use the dotnet-pack --version-suffix with csproj?
I'm trying to use the .net Core tools RC4 dotnet pack command to create a nuget package with a suffix.
I can create "MyProject.1.2.3.nupkg" successfully but I want "MyProject.1.2.3-beta.nupkg".
...
29
votes
3
answers
12k
views
How can I use BeforeBuild and AfterBuild targets with Visual Studio 2017?
After upgrading to a csproj to use Visual Studio 2017 and Microsoft.NET.Sdk, my "BeforeBuild" and "AfterBuild" targets are no longer running. My file looks like this:
<Project Sdk="Microsoft.NET....
28
votes
2
answers
13k
views
Is There a Way to Force a Project Reference to .NET Standard Project to a Specific TargetFramework
I am a contributor to a GitHub project, and recently we had some trouble with our .NET Standard 2.0 project installing correctly into a .NET Framework 4.5 project. The cause of this is that (if I am ...
28
votes
2
answers
11k
views
'dotnet build' specify main method
I am using dotnet to build a .NET Core C# project from the command line. The project has multiple classes with a main method. Thus I get the error:
$ dotnet build
Microsoft (R) Build Engine version ...
27
votes
3
answers
14k
views
How to get the current operating system in MSBuild?
I have a .NET Core 1.1 console project created with Visual Studio 2017.
After building the project, I need to run a powershell script so I added the following to the MyProject.csproj file:
<Target ...
26
votes
2
answers
23k
views
MSBuild publish dotnet core application
My setup is: I have a solution that had different dotnet4.6 applications (services) in it. Now we added a dotnet core project inside this solution. I can build and debug it, but this doesn't create an ...
25
votes
7
answers
25k
views
How to copy files to output directory from a referenced NuGet package in .NET Core csproj?
I'm trying to use PhantomJS NuGet package in .NET core csproj application. But I think it is not possible using new PackageReference syntax for NuGet.
When I reference the PhantomJS package like ...
24
votes
9
answers
59k
views
The reference assemblies for framework .NETCore, Version=v5.0 were not found
I have a UWP project that was created using Visual Studio 2017. It builds fine on this machine (machine 1).
However, when I copy the project over to a machine (machine 2) where I only have the Visual ...
24
votes
1
answer
87k
views
Where to get msbuild for Linux [duplicate]
I want to build a .net core project on Windows and Linux.
For Windows I use MSBuild, simply downloaded the Build Tools für Visual Studio 2017 from visualstudio.com.
But where do I get MSBuild for ...
23
votes
7
answers
6k
views
Building SQL Server Database Project In Ubuntu
I'm building an ASP.NET Core 2.0 Web API application that is hosted in an Ubuntu environment. So far, I've had great success getting things building and running (for the .NET Core app) in Ubuntu.
For ...
22
votes
1
answer
14k
views
Understanding .NET Core csproj actions
I'm trying to have the contents of a folder copied to build output. Ideally under the same path relative to the output/publish folder. I have:
<!-- front-end files to serve -->
<ItemGroup&...
22
votes
2
answers
39k
views
dotnet publish command is not creating zip file package for asp.net core web application project
I am trying to create a web deployment package for asp.net core web application. When I tried to publish the output as a package using VS2017, I got all the necessary files in "Publish" folder as well ...
22
votes
1
answer
53k
views
How to get MSBuild 15 without a full install of Visual Studio?
"MSBuild is now installed in a folder under each version of Visual Studio." However, I do not want to install a full VS on the server. "MSBuild is now available as part of the .NET Core SDK."
Now ...
17
votes
7
answers
23k
views
The Dnx Runtime package needs to be installed. See output window for more details
I'm using Visual Studio 2015 Enterprise Edition and created simple Asp.net5 application. When I try to debug I'm getting this error.
The Dnx Runtime package needs to be installed. See output window ...
17
votes
2
answers
9k
views
dotnet core 2 long build time because of long restore time
I noticed that building in dotnet core 2 seemed a lot slower.
But the timing after the build always showed 'only' 15 seconds.
I couldn't believe that so I timed it with time.
> time dotnet build
...
16
votes
1
answer
10k
views
What is the purpose of msbuild's GenerateRuntimeConfigurationFiles?
I upgraded a netcore1.1 project to the new VS2017/csproj.
In my test projects only, it added:
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</...
15
votes
4
answers
8k
views
dotnet publish profile ignores pubxml file
I have the following pubxml file which I created via Visual Studio 2019:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<...
15
votes
1
answer
16k
views
What's the version history of MSBuild?
What is the version history of MS Build?
I see that my .NET Framework installation folders have a version 4.something where as the Visual Studio 2017 Community folder and the .NET Core (v1.0) folder ...
14
votes
1
answer
12k
views
Assembly location for Razor SDK Tasks was not specified
My project fails to build on a build server.
I recently added a new ASP.Net Core (2.2) MVC project with razor pages. The project and the rest of the solution target the .Net Framework 4.7.2.
In ...
14
votes
4
answers
23k
views
The attribute "Version" in element <PackageReference> is unrecognized
I have a solution with many projects that target .net 4.6.1. On our MS build server it builds just fine. I recently added a project that targets .NET Standard 1.3. This will not build on the build ...
13
votes
1
answer
12k
views
dotnet build not compiling .NET Framework 4.6.1 Application
I am trying to compile a solution using dotnet build on command line. This solution unfortunately has projects which target different frameworks. Most of these have been migrated to target .NET ...
12
votes
1
answer
15k
views
How to read/get a PropertyGroup value from a .csproj file using C# in a .NET Core 2 classlib project?
I want to get the value of the element <Location>SourceFiles/ConnectionStrings.json</Location> that is child of <PropertyGroup /> using C#. This is located at the .csproj file for a ....
12
votes
1
answer
13k
views
How to "dotnet pack" an already compiled project
I'm trying to design a build script for a dotnet core 2.0 project that does the following actions
Cleans output directories
Builds Solution with -o bin\Publish
Runs Unit Tests with dotnet vstest
...
12
votes
2
answers
4k
views
`dotnet sln add` wrong project type GUID
When I do dotnet sln add {myProject.csproj} for a .NET Core/Standard project, it adds it as project type (I think) {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} instead of .NET Core's {9A19103F-16F7-4668-...
12
votes
0
answers
1k
views
Prevent `dotnet pack --no-build` from triggering a build and causing NETSDK1085
I expect that when running the following two commands, the latter will not trigger a new build:
dotnet build solution.sln --configuration Release
dotnet pack solution.sln --configuration Release --no-...
11
votes
2
answers
8k
views
MSBuild /t:pack Nuget-Package has always the same Version
I am creating a nuget-package with /t:pack in my TFS-Build. I can't the use Nuget-Pack-Step, because I am using
<TargetFramework>netstandard2.0</TargetFramework>
How can I apply my ...
11
votes
1
answer
13k
views
dotnet core publish: include/exclude dir in output
Given aspnet project with folders:
/
/sql
/WebApp
/Client
/wwwroot
/Views
On project.json I used
"publishOptions": {
"include": [
"..\\sql",
"wwwroot",
"Views",...
11
votes
4
answers
5k
views
How to set the MSBuild verision for TeamCity NuGet Installer?
I'm trying to restore NuGet packages for a .NET Core solution using NuGet Installer TeamCity build step. The 'MSBuild auto-detection' chooses MSBuild v4.0 instead of v15.0 which is required for .NET ...
11
votes
2
answers
7k
views
Conditional per TargetFramework in MsBuild 15
With the new MsBuild version it's really easy to target multiple frameworks and framework versions in .csproj project:
<TargetFrameworks>net40;net45;net461;netcoreapp1.1</TargetFrameworks>...
11
votes
1
answer
5k
views
Automatically nest files in .csproj class libary (DependentUpon)
I have a number of C# files I am generating. I would like them to automatically be nested under the matching C# file inside the Visual Studio solution explorer. For example, Foo.Generated.cs and Bar....
11
votes
1
answer
3k
views
How can I check if MSBuild is using .NET Core?
I am using Scripty.MsBuild to generate some files in a ASP.NET Core project. When I build from VS2017, the target runs successfully, but when I build via dotnet, I get the error:
Scripty.MsBuild....
11
votes
2
answers
2k
views
Asp.net website project targeting 4.7.2 cannot resolve .netstandard 2.0 reference using MSBuild
I have a .net 4.0 asp.net website (the old ones, with no .csproj).
This references a .net framework 4.0 class library (Shared Library A).
I have added a new .net core API project to the solution.
...
11
votes
4
answers
5k
views
Building .NET Core 1.0 RC2 app on the build server
I've updated my app from DNX, ASP.NET 5 RC1 to ASP.NET Core 1.0 RC2.
Locally it builds and runs fine.
On the build server, I don't have Visual Studio installed, and the build fails with:
error ...
10
votes
3
answers
2k
views
Is it possible to remove the full-paths from .NET assemblies created with dotnet build?
I build my project with dotnet build, targeting netcoreapp3.1.
The problem is that the assemblies contain the full path to the source-files:
/home/runner/my-app/App.fs
This means that the hash of the ...
10
votes
2
answers
2k
views
DotNet Core .csproj code files as child items
I am migrating an old .NET Framework csproj to dotnet core. What is the dotnet core equivalent of this:
<Compile Include="ServiceHost.Designer.cs">
<DependentUpon>ServiceHost.cs</...
10
votes
2
answers
4k
views
dotnet publish succeeds on dev machine, build agent fails, asp.net Netcoreapp2.1/win-x64
On "Hosted VS2017" and self-hosted build agent (Windows Server 2012 R2), running dotnet publish with a publish profile specified fails with:
C:\Program
Files\dotnet\sdk\2.1.502\Sdks\Microsoft.NET....
10
votes
3
answers
5k
views
.NET Core - build project specifying ReferencePath
I have a .csproj for the .NetCore platform with classic references. I'm using the hintpath attribute for the development environment. But I should build csproj on the CI-environment where referenced ...