csproj

web deploy package not picking up parameters.xml when using latest csproj format

风格不统一 提交于 2019-12-08 07:53:23
问题 I have a project which is being updated to use the new .csproj format. We used to use the following msbuild arguments: msbuild Logging.sln /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="C:\Source\webdeploy" Which created a .zip web deploy package. In the top level of this folder was parameters.xml, which is a copy of a custom parameters.xml from the project being built. Since moving to the new .csproj format, the .zip is still

MSBuild: Include a custom resource file as embedded resource

℡╲_俬逩灬. 提交于 2019-12-08 00:39:34
问题 I am dynamically generating a resource-file at build time with MSBuild, but in order to be able to read from this resource file at run-time, I need it to be an embedded resource. I have looked everywhere at how to mark a file in a .csproj as embedded resource, I have even tried this to no avail. <ItemGroup> <Content Include="Infrastructure\Content\Store\content_store_en.json" /> <EmbeddedResource Include="Infrastructure\Content\Store\content_store_en.json"> </EmbeddedResource> </ItemGroup> Is

VS 2017 new project format and external props file

北慕城南 提交于 2019-12-07 19:29:30
问题 Lets say I have the following project file: <Project> <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <PropertyGroup> <TargetFramework>net47</TargetFramework> </PropertyGroup> <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> </Project> Is it possible to move TargetFramework property to external props file? When I try doing that, Visual Studio gives me a "one-way upgrade" error. 回答1: You've hit a known issue in the way that Visual Studio interprets csproj files. On command line

Parse csproj via c# - cannot parse ItemGroup

好久不见. 提交于 2019-12-07 17:20:43
问题 I try to get all dll names from csproj file, but cannot get anything! So,i try to get al elements from ItemGroup tag with liq query: var elem = doc.Descendants("Project").Where(t => t.Attribute("ToolsVersion")!=null) .Elements("ItemGroup").Elements("Reference").Where(r => r.Attribute("Include") != null); var attrs = elem.Attributes(); Console.WriteLine(attrs.Count()); foreach (var e in attrs) { Console.WriteLine(e); } And this is my xml csproj file. I cut some unusfull text)) <?xml version="1

Project generates a nuget package that depends on another project that does not create a nuget package

£可爱£侵袭症+ 提交于 2019-12-07 16:54:05
问题 If I have a project (P1) that builds a nuget package, and I make it depend on a project (P2) that doesn't build a nuget package, the generated package will still reference P2 as a nuget package . Steps to reproduce Create a solution with 2 C# projects (P1 and P2) Make P1 depend on P2. Add the following line to P1.csproj (to make it build a nuget package) <GeneratePackageOnBuild>true</GeneratePackageOnBuild> Build the solution Open the generated P1.nupkg in, e.g., NuGet Package Explorer Note

Visual Studio Linked Files Directory Structure

不羁岁月 提交于 2019-12-07 14:04:57
问题 I have two versions of a project. One for Silverlight and one for .NET. The SL project has the vast majority of the code base in it. I want to globally add all files from the SL project into the .NET version as linked files. I've managed to do so successfully like this in the csproj file for the .NET version: <Compile Include="..\MyProj.Common.SL\**\*.cs" Exclude="..\MyProj.Common.SL\Properties\**"> Unfortunately, this adds all the files right to the root of my project... so I end up with a

How to add a reference to an Azure Function C# project?

[亡魂溺海] 提交于 2019-12-07 12:23:02
问题 With the help of the latest Azure SDK, I got the Azure Function tools For Visual Studio So that I can debug my Azure Function on premises - cool. My azure function needs to use the code of a Business object dll From the .csx script I can make a reference to the .dll with such a directive at the start #r "ServiceBusQueue.Shared.dll" There is no "Add reference..." in an Azure function project. I can only add a Build dependency so that the business object dll is built first. But when the dll

Best way to parse VisualStudio .csproj file using python

。_饼干妹妹 提交于 2019-12-07 08:18:50
问题 What is the best way to parse Visual Studio .csproj file using python, for further modification? It is some .csproj file: ... <ItemGroup> <Reference Include="SomeAssembly, Version=1.1.1.1"/> ... </ItemGroup> ... I want to insert this: <HintPath>path/to/SomeAassembly.dll</HintPath> into the <Reference/> node. 回答1: VS project files are XML. Python comes with a number of XML parsing libraries: http://docs.python.org/library/markup.html Either of xml.parsers.expat or xml.minidom could accomplish

How can .csproj know about its solution?

巧了我就是萌 提交于 2019-12-07 05:32:13
问题 In .csproj files you can use variables like $(SolutionDir). It's possible to find libraries that way. How it's possible you can build .csproj by msbuild (not giving it solution path)? I can't see any sense in such behaviour, but it's working anyway. 回答1: Individual project files do not have awareness of what solution they are part of. Variables $(SolutionDir), $(SolutionPath), $(SolutionExt), etc, only defined when you build your .sln file, they are not defined when you build project directly

MSBuild Post-Build

隐身守侯 提交于 2019-12-07 04:23:34
问题 I've got an MSBuild script that is just about doing everything that I need it to do apart from my post-build step (see a previous question that I asked: MSBuild conditional Exec?). What I'm looking to do is build many csproj files and optionally perform post-build steps if and only if the project was built. I don't want to perform my post-build step all the time or else the timestamp on my final output will be modified unnecessarily (and it makes the build process very time consuming for no