Does anyone know how to change the Build directory of an ASP.NET Core project? In the project settings under build, the output path is readonly.
Right-click on the project node in Solution Explorer and select Properties. Expand the Build section, and select the Output subsection. Find the Base output path for C#, and type in the path to generate output to (absolute or relative to the root project directory), or choose Browse to browse to that folder instead.
In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.
If you've already installed it and want to change the location, you must uninstall Visual Studio and then reinstall it. In the Shared components, tools, and SDKs section, select the folder where you want to store the files that are shared by side-by-side Visual Studio installations.
You can define pre/post script commands in your project.json
in the scripts
section. Even execute multiple commands, when you turn the postcompile
from string to an array ["command1", "command2", "command3"]
Other workaround is-
Open your ASP.NET core project .xproj file in Notepad and change OutputPath
from
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
to
<OutputPath Condition="'$(OutputPath)'=='' ">E:\SanketTest</OutputPath>
Once done, reload your project and it will automatically build in specified location.
See if this helps.
Edit the .csproj
file manually.
Set the Outputpath as desired:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath Condition="'$(OutputPath)'=='' ">..\bin\Release\</OutputPath>
</PropertyGroup>
This will still generate subfolders for the framework version and the runtime identifier. To remove those add this to your project file:
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
ASP.NET Core projects are built using the .NET Core CLI. The output can be controlled by adding options the command-line call do "dotnet build".
Example:
dotnet build --output bin/whatever/ --framework netcoreapp1.0
See dotnet build --help
for all available parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With