csproj

Programmatically create a csproj on the fly without Visual Studio installed

≡放荡痞女 提交于 2020-08-23 08:24:43
问题 I am attempting to generate a .csproj file programatically using the MSBuild namespace, but the lack of code samples is making this a tedious and error prone process. So far, I have got the following code but I am not sure how to add classes, references and such to the project. public void Build() { string projectFile = string.Format(@"{0}\{1}.csproj", Common.GetApplicationDataFolder(), _project.Target.AssemblyName); Microsoft.Build.Evaluation.Project p = new Microsoft.Build.Evaluation

Target V4.7.2 and netcoreapp3.1 in same project. Value does not fall witnin the expected range

隐身守侯 提交于 2020-07-03 11:51:46
问题 I want my Framework 4.7.2 code to use a library that targets netcoreapp3.1 Nuget indicates that the library is referenced, yet I do not see it in the list of references. I tried editing the project to change the TargetFrameworkVersion from <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> to <TargetFrameworkVersion>v4.7.2;netcoreapp3.1</TargetFrameworkVersion> But saving this change causes a message And I cannot re-load the project I tried chainging to <TargetFrameworkVersion

Can't access ArtifactStagingDirectory variable in MSBuild

偶尔善良 提交于 2020-06-27 13:42:48
问题 During my build process I'm trying to copy a folder to the artifacts folder (\myserver\d$\TFBuild-Agent01\66\a). So I put this in the .csproj file: <Target Name="BeforeBuild"> <Exec Command="xcopy.exe Databases "$(Build.ArtifactStagingDirectory)\Databases" /i /e /y /d" /> </Target> This gets me Error MSB4184: The expression """.ArtifactStagingDirectory" cannot be evaluated. Method 'System.String.ArtifactStagingDirectory' not found* Everything I can find online says that $(Build

Can't access ArtifactStagingDirectory variable in MSBuild

こ雲淡風輕ζ 提交于 2020-06-27 13:42:28
问题 During my build process I'm trying to copy a folder to the artifacts folder (\myserver\d$\TFBuild-Agent01\66\a). So I put this in the .csproj file: <Target Name="BeforeBuild"> <Exec Command="xcopy.exe Databases "$(Build.ArtifactStagingDirectory)\Databases" /i /e /y /d" /> </Target> This gets me Error MSB4184: The expression """.ArtifactStagingDirectory" cannot be evaluated. Method 'System.String.ArtifactStagingDirectory' not found* Everything I can find online says that $(Build

How to know full paths to DLL's from .csproj file?

隐身守侯 提交于 2020-06-27 12:17:34
问题 I wonder if there is some way to know full paths to the dll's that are listed in .csproj file. The most interesting for me is to resolve paths to default dll's like System.Xml.dll, System.Data.dll and etc. In the .csproj file there are only lines with short names: <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference>

Is there a way to read file from Azure DevOps YAML?

感情迁移 提交于 2020-05-29 09:56:45
问题 When doing my CI on Azure DevOps with the YAML file format, I'm trying to read my csproj files to extract informations about version to create NuGet packages that will follow the csproj version. I'm using NuGetCommand@2 for packaging (because of versioningScheme: byPrereleaseNumber ) Is there a built-in task or a way to extract this info from csproj file as a regex and pass them to NuGetCommand@2 ? 回答1: I'm fairly sure there is nothing built-in for this, but you can use any scripting language

How do I use ASP.NET Core 3.0 types from a library project for shared Controllers, Middleware etc?

自闭症网瘾萝莉.ら 提交于 2020-02-26 07:11:25
问题 While ASP.NET Core up to 2.2 could be consumed through NuGet to create library projects for shared Controllers, Middleware etc, how do I create a library that is able to use ASP.NET Core 3.0 types? While for projects containing views there is a "Razor Class Library" ( razorclasslib ) template, how do I create a library that only contains logic components? 回答1: Applications built for .NET Core 3.0 can reference one or more shared frameworks. ASP.NET Core is one of these shared frameworks