Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:54

    rainersigwald on vsix-depend-on-nuget

    VSIX dependency on NuGet.BuildT… Disambiguate branch name (compare)

  • Jan 31 2019 22:45
    livarcocc review_requested #4121
  • Jan 31 2019 22:45
    livarcocc review_requested #4121
  • Jan 31 2019 22:45
    livarcocc opened #4121
  • Jan 31 2019 22:42
    daryllabar commented #545
  • Jan 31 2019 21:40
    JL2210 edited #4116
  • Jan 31 2019 21:40
    JL2210 edited #4116
  • Jan 31 2019 21:39
    JL2210 commented #4116
  • Jan 31 2019 21:05
    livarcocc milestoned #4116
  • Jan 31 2019 21:05
    livarcocc commented #4116
  • Jan 31 2019 20:55
    rainersigwald milestoned #4120
  • Jan 31 2019 20:55
    rainersigwald demilestoned #4120
  • Jan 31 2019 20:53
    livarcocc synchronize #4115
  • Jan 31 2019 20:53

    livarcocc on vs16.0

    Bump version to disambiguate wi… Merge pull request #4119 from r… (compare)

  • Jan 31 2019 20:53
    livarcocc closed #4119
  • Jan 31 2019 20:50

    livarcocc on livarcocc-patch-1

    (compare)

  • Jan 31 2019 20:50

    livarcocc on vs16.0

    Adding a vs16.0 trigger Updating to a more general trig… Merge pull request #4118 from M… (compare)

  • Jan 31 2019 20:50
    livarcocc synchronize #4115
  • Jan 31 2019 20:50
    livarcocc closed #4118
  • Jan 31 2019 20:46
    livarcocc milestoned #4120
Stefan Lörwald
@stefanloerwald
Haven't reported because it's not appearing with VS preview, but it might be because of extensions, good point. I'll see once I'm back at my machine
Stefan Lörwald
@stefanloerwald
The copy/paste issue is because of an extension: madskristensen/Tweakster#43
I should have learned from the abandonded https://github.com/madskristensen/webcompiler that I shouldn't install more extensions from Mads...
Joseph Musser
@jnm2
Well, it is preview. That's a bit harsh.
You don't know what you don't know until someone discovers and reports it.
This is true of every project I've ever seen that is actually used in the real world.
But especially preview; that's literally someone saying "only use if you're cool with your workflow being broken"
Stefan Lörwald
@stefanloerwald
You're right, forgiven for that bug.
Michael W Powell
@mwpowellhtx
Hello, curious, I have a Windows Forms app targeting netcoreapp3.1 and Sdk="Microsoft.NET.Sdk.WindowsDesktop", trying to effect a tooling to bump some versions.
but nothing runs, no versions are bumped. I am getting an MSB4181 error, which I think may have to do with pinning to a correct (for the tooling) version of an SDK runtime, possibly.
can anyone confirm along these lines?
My tooling targets netstandard2.0 that's it. and the intended usage is as stated above, an app targeting netcoreapp3.1 and with project Sdk="Microsoft.NET.Sdk.WindowsDesktop".
and if I check my dotnet SDKs, indeed I have 3.1.402 [C:\Program Files\dotnet\sdk] only, plus 2.1.518 [C:\Program Files\dotnet\sdk], but for purposes of the target assembly build, I think it is trying for 3.1.402.
have read some other blog posts indicating similar MSB4181 errors along these lines.
just in general, how do I ensure that my tooling always pins to the correct SDK and/or runtime in order to run properly no matter what?
this is an area I am also somewhat unfamiliar with, but I want to understand it better, let's just put it that way.
can I introduce a runtimeconfig.json file in my tooling to help make sure that happens?
Igor Velikorossov
@RussKie
Yes
Michael W Powell
@mwpowellhtx
@RussKie "Yes" to what? pin a runtime config? to which run time?
Something other than 3.1.402 at any rate, I gather. a total and complete snafu where my tooling is concerned.
erikljung
@erikljung
Hi, I know it can be detected whether msbuild was invoked from Visual Studio or not, but would it be possible to detect if it was a test runner (and not a regular build) which caused the build?
erikljung
@erikljung
(or any hack that could solve that)
Gregory Pakosz
@gpakosz

Hello. First time here.
I'm discovering the ReadLinesFromFile task

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="Build">
    <ReadLinesFromFile
        File="C:\config.txt" >
        <Output
            TaskParameter="Lines"
            ItemName="config"/>
    </ReadLinesFromFile>
    <Message Text="@(config)" />
  </Target>
</Project>

The config.txt file looks like this

foo=true
bar=false

I have 2 questions
• Is it possible to use Condition in the <Output> element to keep only lines matching a pattern?
• Knowing that my config file is named of key=value lines, is it possible to dynamically populate properties from the resulting config item?

Gregory Pakosz
@gpakosz

I can do

    <ItemGroup>
      <config2 Include="@(config)"
              Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', 'foo'))"
              />
    </ItemGroup>

But when I try

    <ReadLinesFromFile
        File="C:\config.txt" >
        <Output
            TaskParameter="Lines"
            Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', 'foo'))"
            ItemName="config"/>
    </ReadLinesFromFile>

msbuildcomplains with error MSB4095: The item metadata %(Identity) is being referenced without an item name

Michael W Powell
@mwpowellhtx
@gpakosz not 100% certain, but I am 92.6% positive that Condition occurs before <Output ... /> in this case, with a config variable receiving that output. So there is not enough information to do the %(Identity) step; IOW, Identity of what?
Try wrapping that in a <Target /> and reporting what that config %(Identity) was, perhaps.
Gregory Pakosz
@gpakosz

So I managed to write this

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="ReadConfig" BeforeTargets="Build"> 
    <ReadLinesFromFile
        File="C:\config.txt" >
        <Output
            TaskParameter="Lines"
            ItemName="ConfigFile"/>
    </ReadLinesFromFile>
    <ItemGroup>
      <Config Include="@(ConfigFile)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', '\w+\s*=\s*\w+'))">
        <Key>$([System.String]::Copy('%(ConfigFile.Identity)').Split('=')[0])</Key>
        <Value>$([System.String]::Copy('%(ConfigFile.Identity)').Split('=')[1])</Value>
      </Config>
    </ItemGroup>

    <CreateProperty Value="%(Config.Value)">
      <Output TaskParameter="Value" PropertyName="Foo" Condition="'%(Config.Key)' == 'foo'"/>
    </CreateProperty>
    <Message Text="[ReadConfig] ConfigFile: @(ConfigFile)" />
    <Message Text="[ReadConfig] Foo : $(Foo)" />
    <Message Text="[ReadConfig] Foo enabled" Condition="$(Foo)"/>
  </Target>

  <Target Name="Build">
    <Message Text="[Build] ConfigFile: @(ConfigFile)" />
    <Message Text="[Build] Foo : $(Foo)" />
    <Message Text="[Build] Foo enabled" Condition="$(Foo)"/>
  </Target>
</Project>

Still with config.txt file containing

foo=true
bar=false
Gregory Pakosz
@gpakosz
Now I'm trying to move that to a Visual Studio project and include a property sheet based on $(Foo)
Gregory Pakosz
@gpakosz
Right it seems I can't use that approach at all. As property sheets import is evaluated before tasks even run
Ivan Sanz Carasa
@isc30
Hi, I'm having difficulties implementing a custom MsBuild task when using net5.0 as TargetFramework
https://github.com/isc30/custom-msbuild-task
created that repository that reproduces the issue
Severity    Code    Description    Project    File    Line    Suppression State
Error    MSB4018    The "TestTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at CustomTask.TestTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    TaskConsumer    E:\projects\custom-msbuild-task\TaskConsumer\TaskConsumer.csproj    13
Ivan Sanz Carasa
@isc30
Érico Vieira Porto
@ericoporto
I have a CLR/C++ code that is using /Z4p that builds fine on my VS2019 install but it gives me an error when I build it in a container that has the command line tools of VS2019 installed.

C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winnt.h(2483): error C2338: Windows headers require the default packing option. Changing this can lead to memory corruption. This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined. [C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\Editor\AGS.Native\NativeDLL.vcxproj]
(last line is specific to my project and can be ignored)
The only difference I was able to pick is slight different cl.exe
In the container, cl.exe is Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
In my machine, cl.exe is Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24245 for x86
Érico Vieira Porto
@ericoporto
In the documentation says CLR won't respect alignment so I am not sure if there was a default change (https://docs.microsoft.com/en-us/cpp/dotnet/how-to-migrate-to-clr?view=msvc-160)
Érico Vieira Porto
@ericoporto
At same time "The headers aren't affected by any /Zp option you set on the command line" (https://docs.microsoft.com/en-us/cpp/build/reference/zp-struct-member-alignment?view=msvc-160) which makes it more weird because if it's not on the command line, where would be the alignment change?
Jerome Haltom
@wasabii
Hey folks. Trying to figure out the proper wya to include a DLL into a MSBuild file (SDK-style). Just adding it to ContentWithTargetPath isn't ensuring it ends up referenced in the .deps.json file. I'm sure there's some metadata for that though.
A native DLL. Packed into runtimes/rid/native
Dan Vicarel
@Rabadash8820
Hi friends. I would like to call Environment.GetFolderPath in a property function, with the following line <UnityInstallRoot>$([System.Environment]::GetFolderPath([System.Environment]::SpecialFolder::UserProfile))/Unity/Hub/Editor/</UnityInstallRoot>, but VS is showing a pop-up error with Invalid static method invocation syntax. It looks like this question has been asked before, but that was back in 2017, so I'm curious if the answer has changed. Am I missing something obvious in this syntax?
Bill Hertzing
@BillHertzing
Hi folks, I'm trying to move my code development from Visual Studio 2019 (VS) to Visual Studio Code (VSC). I'm currently stuck on creating the .resources and strongly typed files (for c#, .cs) from the .resx files. VS had plenty of built-in tooling to support this; in particular it has ResXFileCodeGenerator and PublicResXFileCodeGenerator to generate the strongly typed class from the .resx file, and it would add MSBuild code to the .csproj file to generate and embed the .resource files into the assembly being built. However, I can't find much on the internet on how to do this in the VSC editor. I've done a couple days of searching, and have found some explanations involving GenerateResource task, but no complete examples.
I'd like to know how to add, to the Directory.Build.props, and Directory.Build.targets files, the correct MSBuild properties, items, itemlists, tasks, and targets, that will 1) find all .resx files (both default and culture-specific) under any subdir under the project directory under the solution directory, create a public strongly-typed .cs file and ensure the project is recompiled if the .resx (and hence the .cs) changes, creates the .resource files from the .resx file (for both the default resources and any culture specific resources found), embeds the default culture .resource files into the assembly, and creates the satellite assemblies for any culture-specific .resource files. I'm using MSBuild 16.8.0+126527ff1 for .NET, multiple target frameworks <TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>, .csproj files are in the new SDK format, and I'm using the latest version of VSC. I've spent two days trying a lot of different things, and I'm actually pretty close (using GenerateResource task), but have hit enough pain points (can't seem to get it to accept task batching when also generating strongly-typed .cs files), that I thought I'd ask here if there already exists a solution, before I keep trying to build one of my own. Thanks in advance for any help!
Bill Hertzing
@BillHertzing
@Rabadash8820 I believe that MSBuild accesses static methods from .Net classes using the same syntax as Powershell. I felt it might be true for enumerations from .Net classes as well. Doing some experimentation in PowerShell, I found that, from a PowerShell prompt, that entering[System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile) would display my UserProfile. You might try that syntax for your issue. plus-in-net-class-names has a little bit more detail.
Jerry
@solvingj
When writing a custom task in MSBuild, is there any way to access "current configuration" when the task is executed (Win32|Debug for example). I honestly can't seem to find a way to do it without having to add Configuration and Platform parameters to my build task, and there's no way that's required right? I'm crawling every namespace here and I feel like it must be there but I can't find it: https://docs.microsoft.com/en-us/dotnet/api/?view=msbuild-16-netcore
Dan Vicarel
@Rabadash8820
@BillHertzing thanks for the reply! That pointed in me in the right direction. MSBuild seems to be using some weird "almost PowerShell" syntax. In the end, this expression worked in my MSBuild property: $([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile')) (note the simplified enum member name with single quotes around it)
Dylan Borg
@borgdylan
@radical Is the monof ork of msbuild still worked on? Or is there a migration path to use the .NET SDK version for desktop frameework or mono projects also?
Jose
@pepone
Hey I creating some items in a target with an ItemGroup
<ItemGroup>
            <ClCompile Include="@(_SliceCompile->'%(OutputDir)\%(Filename).%(SourceExt)')"
                       Exclude="@(ClCompile->'%(FullPath)');@(ClCompile->'%(Identity)')" />
        </ItemGroup>
But I would expect the new ClCompile to no inherit any metadata from the _SliceCompile item, but I seeing it is copying the AdditionalOptions,
Jose
@pepone
is there some metadata inheritance for the items generated inside a target?
Jose
@pepone
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="SliceCompile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
    <SliceCompile>
        <AdditionalOptions>--add-header foo.h</AdditionalOptions>
    </SliceCompile>
</ItemDefinitionGroup>
<ItemGroup>
    <SliceCompile Include="Foo.ice">
        <AdditionalOptions>%(AdditionalOptions) --other</AdditionalOptions>
    </SliceCompile>
</ItemGroup>
<Target Name="SliceCompile">
    <ItemGroup>
        <ClCompile Include="@(SliceCompile->'%(Filename).cpp')">
        </ClCompile>
    </ItemGroup>
    <Warning Text="@(ClCompile->'%(ClCompile.Identity) %(ClCompile.AdditionalOptions)'"/>
</Target>
</Project>
Here the ClCompile generated item has all the metadata from SliceCompile, any pointers as to why this happens
Chris McGrath
@clmcgrath

not sure where to put this

having an odd issue with msbuild vscode and visual studio all failing and not able to find critical pieces of .netcore 3.1 / .net 5
i have reinstalled 4x and also tried manually installing from the binary package all of which are failing , it started with not finding the sdk at all , the binary package manual install semms to have fixed that issue but now i am recieving errors about not being able to find the netcoreapp targeting pack , this is happening in all products and the cli as well

Zachary Rice
@zricethezav

Having a difficult time getting a project working with msbuild and nuget. I want to build a project with a packages.json. Can someone help me how I can do this? For example I'm working on this repo https://gitlab.com/gitlab-org/security-products/tests/csharp-dotnetcore-multiproject/-/tree/multiproject-joe. I want to build ServiceA/ServiceA.csproj. From the root of the directory I run:

nuget restore ServiceA/ServiceA.csproj -PackagesDirectory ServiceA

then

msbuild -t:build -p:RestorePackagesPath=ServiceA ServiceA/ServiceA.csproj

Looking at the debug logs it's not able to find the correct references. Any ideas how I can resolve this? Related gitlab issue: gitlab-org/gitlab#233033

Christian Seidlitz
@SeidChr

hi there

anyone has an idea how i could exclude a referenced analyzer package in a normal "dotnet build" command, but include it in the roslyn compiler stuff whick is used to generate the warnings and hints in vscode (probably called by omnisharp)
is there any environment variable i can check which is set during a normal build and not set on the others?