Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting BasePath properties in csproj breaks dotnet cli commands #1018

Closed
davkean opened this issue Mar 21, 2017 · 2 comments
Closed

Setting BasePath properties in csproj breaks dotnet cli commands #1018

davkean opened this issue Mar 21, 2017 · 2 comments

Comments

@davkean
Copy link
Member

davkean commented Mar 21, 2017

From @couven92 on March 18, 2017 12:32

I personally dislike having the bin and obj folder in the project directory, especially in solutions with multiple projects in them. Because of that, I have always since the beginning of time modified the BaseOutputPath and BaseIntermediateOutputPath properties in my csproj files like this:

<Project>
  <PropertyGroup Label="BasePath">
    <BaseOutputPath>$(SolutionDir)bin\</BaseOutputPath>
    <BaseIntermediateOutputPath>$(SolutionDir)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
  </PropertyGroup>
</Project>

When running just MSBuild MySolution.sln this works fine, and if I just build a single project in my solution, well either I set the SolutionDir property manually, or simply face the fact that SolutionDir is empty. All this works fine when running MSBuild from the developer command line and runs fine from building in Visual Studio.

However, neither the dotnet restore, dotnet build or even dotnet msbuild commands work with this setup. The restore command still creates the obj files in the project directory (instead of the solution directory) and the build command fails, because dependencies are not resolved correctly.

Dotnet Environment:

> dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.1

Copied from original issue: dotnet/project-system#1789

@dsplaisted
Copy link
Member

See dotnet/msbuild#1603 (comment) for information on how to do this correctly.

@livarcocc
Copy link
Contributor

Closing this one as we have workarounds and we have a bug in msbuild tracking potentially improving it. Re-activate if there is something that we need to do in the SDK.

mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
…0191018.6 (dotnet#1018)

- Microsoft.AspNetCore.Analyzers - 3.1.0-preview2.19518.6
- Microsoft.AspNetCore.Mvc.Api.Analyzers - 3.1.0-preview2.19518.6
- Microsoft.AspNetCore.Mvc.Analyzers - 3.1.0-preview2.19518.6
- Microsoft.AspNetCore.Components.Analyzers - 3.1.0-preview2.19518.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants