-
Notifications
You must be signed in to change notification settings - Fork 359
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
dotnet new removes PropertyGroup related to build inside csproj #1195
Comments
HI @marcusien - there is a bug in some older versions (including 1.0.4) of dotnet new which causes some conditions in proj files to be incorrectly consumed during template creation. To work around this, there is a directive you can add to your proj file to turn off template engine processing. Specifically, add this to your csproj file before the PropertyGroup being incorrectly removed: If there is content later in the file that should be processed, the processing can be turned back on using the slightly different directive: The csproj file in the template would end up looking something like this (extra comments added for clarity):
If there is no content needing processing after you've turned processing off, there's no need to turn it back on. The processing on/off is scoped to the file, so this wouldn't affect how other files in the template are handled. |
Hi @seancpeters , I tried with your workaround and it works fine :) thank you !! However I'm using the CLI version : v2.0.0-preview2-006497. |
It's fixed in the current newest bits available at http://gitHub.com/dotnet/cli/ - for example 2.0.1-servicing-006924 |
Thank you 👍 |
Hi,
Is it posible for the "dotnet new" command not to remove the s from csproj which are related to build stuffs.
For instance, I got this in a "net core" csproj :
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MyConfiguration|AnyCPU'"> <Optimize>False</Optimize> </PropertyGroup>
But when I use my template to create a new project, this kind of PropertyGroup is simply removed.
This is more annoying for classic csproj that are contained in my templates, cause it removes this kind of propertygroup content (that are mandatory on classic csproj)
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <NoWarn>1701;1702;1705;1591</NoWarn> </PropertyGroup>
When I'm first trying to build my brand new project (created with my template), it does not build cause it tells me that "The OutputPath property is not set for project 'MyProject.csproj'"
The text was updated successfully, but these errors were encountered: