csproj

Create a custom powershell script for nuget that adds a custom target to the csproj BeforeBuild step

依然范特西╮ 提交于 2019-12-30 00:42:06
问题 I want to create a nuget package that adds a BeforeBuild step to my csproj using a custom MSBuild task I have created. Ideally, I want to: Add a new Target into the csproj file (MyCustomBeforeBuildTarget) Add the BeforeBuild target if it is not already there Edit the BeforeBuild DependsOnTargets attribute to include my custom target So after install my csproj should have the following in: <Target Name="MyCustomBeforeBuildTarget" Condition="SomeCondition"> <MyCustomTask /> </Target> <Target

.csproj multiple hint paths for an assembly

两盒软妹~` 提交于 2019-12-28 04:51:12
问题 I'm packaging example code for an SDK distribution. In the distribution, the relative path from code to the SDK assemblies is different from the build machine. For example: Distribution csharp/bin/assembly.dll example/ex1/ex1.csproj Build Machine foo/sdk/csharp/bin/assembly.dll bar/baz/quux/ex1/ex1.csproj Assume that I can't move anything. Is there a way I can instruct ex1.csproj to look in both ../../csharp/bin/ and ../../../../foo/sdk/csharp/bin/ for assembly.dll ? In C++ I'd put the

<Subtype>Designer</Subtype> Added then removed by Visual Studio on load/unload

怎甘沉沦 提交于 2019-12-28 03:23:27
问题 Anyone see this before? I have a large Visual Studio project that keeps adding [Subtype]Designer[/Subtype] to my .vcproj then removing it on the next open and close of the project. There is only one class defined in StoredImageControl.cs . Anyone know how to shut this off as it is really messing up my revision control. This is before: <EmbeddedResource Include="StoredImageControl.resx"> <DependentUpon>StoredImageControl.cs</DependentUpon> </EmbeddedResource> This is after <EmbeddedResource

Including content files in .csproj that are outside the project cone

﹥>﹥吖頭↗ 提交于 2019-12-27 16:50:48
问题 I have a C# project say MyProject.csproj located at "C:\Projects\MyProject\". I also have files that I want copied into the output directory of this project. But, the files are at the location "C:\MyContentFiles\", i.e. they are NOT within the project cone. This directory has sub-directories as well. The contents of the directory is not managed. Hence I have to include all what is under it. When I include them as 'Content' in the project, they are copied, but the directory structure is lost.

PreBuild for PreBuild Event Command in csproj

女生的网名这么多〃 提交于 2019-12-25 04:11:54
问题 Can I specify in csproj file that the exe being executed in prebuild events should be built before executing it? 回答1: You can do it through Visual Studio which will actually edit your .csproj file in fact. Right click on the project and select Project Dependencies and select the project which you need to build before this project. Verify it by selecting the Build order tab. 来源: https://stackoverflow.com/questions/10426029/prebuild-for-prebuild-event-command-in-csproj

How to include asset files in a .NET Standard 1.4 library in ARM platform?

一世执手 提交于 2019-12-24 19:28:39
问题 Anyone know what is the correct way of referencing assets if the platform is ARM? In x86 I can use appX folder with linking but its not working on ARM thanks 回答1: If you want to get assets files from a .NET Standard library, you would need to mark the file as EmbeddedResource and Copy Always . Then, you need to add a method to get these files in your .NET Standard library's class. For example: namespace ClassLibrary1 { public class Class1 { public static Stream GetImage() { var assembly =

How to access custom project properties from a T4 template?

此生再无相见时 提交于 2019-12-24 17:21:58
问题 In VS 2010, is it possible to access a custom project property from a T4 template, e.g. in an Assembly directive? I can't manage to access such properties, e.g. defined in a <PropertyGroup> in my .csproj file. Accessing predefined VS macros (like $(SolutionDir) or $(ConfigurationName) ) works though. Thanks and best regards, Oliver 回答1: I solved the problem by creating a file containing the Assembly directive as a pre-build step (which can access the environment variables). In all my T4

How to have the same VS project with multiple .csproj files depending on the VS version?

≡放荡痞女 提交于 2019-12-24 09:27:53
问题 Sometimes I've seen a solution that includes up to three .csproj files for each project in the solution. Something like this: Project.UI.2005.csproj Project.UI.2008.csproj Project.UI.2010.csproj and the same with .sln files: ProjectSolution.2005.sln ProjectSolution.2008.sln ProjectSolution.2010.sln So if you copy the solution and want to open it using VS2005 , you just need to open Project.UI.2005.csproj or ProjectSolution.2005.sln . What is the best way of creating those 3 (or 2) files, in

Link Additional Files in Visual Studio

瘦欲@ 提交于 2019-12-24 08:39:52
问题 I am trying to include stylecop.json in my C# project on Visual Studio 2017. I have figured out how to do this by modifying the .csproj in any text editor: <AdditionalFiles Include="stylecop.json"> <Link>stylecop.json</Link> </AdditionalFiles> I am wondering if there is a way to do this without making any text edits. I understand I can always add it like any other files but that would make a copy of the file within project folder and not link it externally. 回答1: You can add a Directory.Build

Programmatic coverage exclusions in SonarQube MSBuild runner

天大地大妈咪最大 提交于 2019-12-24 06:23:16
问题 Is there a way to programatically exclude artifacts from Sonar analysis using the MSBuild Scanner? We have a number of different Visual Studio solutions in our git repository. Almost all of these solutions make use of projects containing shared code. I am wishing to exclude code coverage from these common projects - but only for certain Sonar projects. Always excluding a project is straightforward and documented via adding a <PropertyGroup> section in the .csproj . Adding the /d:sonar