question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Project System unconditionally declares the AssemblyName and other properties.

See original GitHub issue

From @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:closed
  • Created 7 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jaredparcommented, Apr 7, 2017

MSBuildSDKsPath needs to be set as an environment variable, not an MSBuild property.

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.

We moved away from that because there was too much VS integration in the SDK for a project to work well before the SDK was restored.

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.

1reaction
tannergoodingcommented, Feb 10, 2017

@jeffkl, in addition to the contents of Microsoft.NET.Sdk.props it looks there are some defaults in Microsoft.NET.Sdk.CSharp.props and Microsoft.NET.Sdk.VisualBasic.props that should be conditioned.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found