csproj

Conditional Content Based Upon Configuration

风格不统一 提交于 2019-11-27 21:45:05
问题 I've tried several times to use a similar technique as "conditional references" for conditional content. Content entries in the Visual Studio Project file such as "web.config" I do not want included when I publish the website. I've tried a few things like... <Choose> <When Condition="$(Configuration) != 'Release'"> <ItemGroup> <Content Include="web.config"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> </When> <Otherwise> <ItemGroup>

How do I use Powershell to add/remove references to a csproj?

时光毁灭记忆、已成空白 提交于 2019-11-27 21:28:38
In relation to this previous question I am trying to create a batch file which as part must remove and add a reference to an XML *.csproj file. I have looked at this , this , this and this previous question but as a powershell n00b am unable to get it working (so far). Can anyone help me with the following? I want to remove two specific references in a VS2010 csproj file (XML) and add a new reference. I opened the csproj and the reference can be found at the following location <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas

Visual Studio project type guids

≯℡__Kan透↙ 提交于 2019-11-27 21:07:13
I downloaded a Visual Studio project but I can't open it in my copy of Visual Studio 2010. Useless error message: The project type is not supported by this installation. What software do I need to open the project type? It doesn't say. I actually went and read the .csproj file, it tells me it's project type <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> Am I meant to recognise what software I need from this random string? This is absolutely ludicrous. I found a site that lists some known project type GUIDs for Visual Studio

MvcBuildViews true with Entity Framework in ASP.NET MVC 2

五迷三道 提交于 2019-11-27 20:25:26
In VS 2010, changing <MvcBuildViews>true</MvcBuildViews> in a MVC2 project's .csproj file causes an error if you are using Entity Framework. Could not load type 'System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider'. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config 129 I want to build views while I'm debugging, and I also want my project to compile! You can resolve this MVC compile issue by adding the following element to your web.config file: <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> This will tell

Easy way to add multiple existing .csproj to a Visual Studio Solution?

两盒软妹~` 提交于 2019-11-27 17:50:46
I've checked out a branch of C# code from source control. It contains maybe 50 projects in various folders. There's no existing .sln file to be found. I intended to create a blank solution to add existing solutions. The UI only lets me do this one project at a time. Is there something I'm missing? I'd like to specify a list of *.csproj files and somehow come up with a .sln file that contains all the projects. Here is a PowerShell version of Bertrand's script which assumes a Src and Test directory next to the solution file. function GetGuidFromProject([string]$fileName) { $content = Get-Content

.csproj multiple hint paths for an assembly

℡╲_俬逩灬. 提交于 2019-11-27 17:40:50
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 dependency path in a standalone property sheet and distribute a different version with the SDK. But C# doesn

Why missing <SccProjectName> in project file cause “The project file is not bound to source control”

╄→尐↘猪︶ㄣ 提交于 2019-11-27 13:33:13
问题 I had a very annoying problem, I have found a solution, but I would like to ask you why it behaves like that... I am using Visual Studio 2012 with TFS 2012. Everything was fine, but one day I have spotted a problem. When I have added a new project to my solution, then I have always obtaining this message every time I have reopened the solution: This project file ... is not bound to source control, but the solution contains source control binding information for it. Do you want... Whatever I

How to upgrade csproj files with VS2017

别等时光非礼了梦想. 提交于 2019-11-27 11:08:08
问题 VS2017 has so far correctly converted several project.json / .xproj based projects to the new .csproj format. I would also like to use the new .csproj format with older .csproj projects that previously targeted only .NET Framework (i.e. they didn't work with dnx/dotnet CLI). It seems that even if a project would still only target .NET Framework, the benefits of <PackageReference> and an easily editable .csproj file seem worth the (hopefully not too great) trouble. Is this possible to do with

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

别说谁变了你拦得住时间么 提交于 2019-11-27 10:45:48
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 Include="StoredImageControl.resx"> <DependentUpon>StoredImageControl.cs</DependentUpon> <SubType>Designer

Understanding a csproj assembly reference

巧了我就是萌 提交于 2019-11-27 09:31:59
问题 I am using VS2010 and I tried to add a few assemblies from local hard disk to my C# project through file reference. Peeking into the csproj file, I found sometimes the file reference appears as <Reference Include="name"> However sometimes it appears as <Reference Include="name, Version=xxx, Culture=neutral, processorArchitecture=MSIL"> What could cause the difference? Inspired by k3b's answer, I did another test. I created a new class library project. Add a file reference. The initial value