Project System unconditionally declares the AssemblyName and other properties.
See original GitHub issueFrom @tannergooding on January 28, 2017 16:53
Description
In MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.props
there are several properties which are unconditionally defined:
<!-- User-facing configuration-agnostic defaults -->
<PropertyGroup>
<OutputType>Library</OutputType>
<FileAlignment>512</FileAlignment>
<ErrorReport>prompt</ErrorReport>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<RootNamespace>$(MSBuildProjectName)</RootNamespace>
<Deterministic>true</Deterministic>
</PropertyGroup>
<!-- User-facing configuration-specific defaults -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x64' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<!-- Default settings for all projects built with this Sdk package -->
<PropertyGroup>
<DebugType>portable</DebugType>
These will override any values that the user may have defined before the parent Sdk.props
file was imported.
Expected Behavior
For the properties which can be overridden by the user (such as AssemblyName
) they should be conditioned to only set the default if it isn’t already set.
For the properties which are not allowed to be overridden (possibly DebugType
), at the very least, a warning should be given if it was already set to a different value.
Copied from original issue: dotnet/roslyn-project-system#1360
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
Project System unconditionally declares the ...
Description In MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.props there are several properties which are unconditionally defined: ...
Read more >c# - Duplicate AssemblyVersion Attribute
Open the project properties and select the Package tab to see the new settings. The Eric L. Anderson's post "Duplicate 'System.Reflection.
Read more >"Assembly.GetExecutingAssembly" should not be called
Using Type.Assembly to get the current assembly is nearly free in terms of performance; it's a simple property access. On the other hand,...
Read more >ProjectProperties.AssemblyName Property (VSLangProj)
The property names for the members of this type can be used as an indexer into the Properties collection. For more information about...
Read more >MSBuild Property Functions (2)
Assembly references are an integral part of build process. When the assembly references passed to the compiler are correct everything works but when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It also doesn’t seem to be absolutely necessary. After chatting with @nguerrera I just switched our
<Import>
to not have an Sdk attribute and use full paths instead. Seems to work just fine.This seems fairly solvable. I agree it presents a couple challenges but was pretty easy to adapt to in our repo. Feels like a big price to pay to remove the ability to override the SDK without admin privs because some developers wouldn’t want to work around this bootstrapping problem.
@jeffkl, in addition to the contents of
Microsoft.NET.Sdk.props
it looks there are some defaults inMicrosoft.NET.Sdk.CSharp.props
andMicrosoft.NET.Sdk.VisualBasic.props
that should be conditioned.