小编D3v*_*r0n的帖子

MSBuild错误MSB3021:无法复制文件.找不到文件'obj\Release\myWebProject1.dll'

使用TeamCity编译我的MSBuild XML任务脚本时,它失败了:

[10:43:03]: myWebProject1\ myWebProject 1 .csproj (3s)
[10:43:07]: [ myWebProject1\ myWebProject1 .csproj] _CopyWebApplicationLegacy
[10:43:07]: [_CopyWebApplicationLegacy] Copy
[10:43:07]: [Copy] C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(131, 5): error MSB3021: Unable to copy file "obj\Release\myWebProject1.dll" to "C:\MSBUILDRELEASE\myWebProject1\\bin\myWebProject1.dll". Could not find file 'obj\Release\myWebProject1.dll'.
Run Code Online (Sandbox Code Playgroud)

当我在本地运行它时,它的工作原理.

当我将本地输出与构建服务器输出进行比较时,构建服务器上缺少文件.就像我的构建服务器输出目录中缺少global.asax文件一样(但是当我在本地编译它时却没有).这是为什么?

这是我目前的MSBuildScript:

<?xml version="1.0" encoding="utf-8"?>
<Project
  xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
  ToolsVersion="4.0"
  DefaultTargets="Build">

  <PropertyGroup>
    <OutputDir>C:\MSBUILDRELEASE</OutputDir>
  </PropertyGroup>

  <ItemGroup>
    <ProjectToBuild Include="UtilityApp.sln" >
      <Properties>OutputPath=$(OutputDir);Configuration=MSBuildRelease;Platform=x86</Properties>
    </ProjectToBuild>
  </ItemGroup>

  <Target Name="Build">
    <MSBuild Projects="@(ProjectToBuild)"/>
            <CallTarget Targets="Publish WebProject1" />
            <CallTarget Targets="Publish WebProject2" />  
  </Target>

<Target Name="Publish WebProject1">
 <RemoveDir Directories="$(OutputFolder)"
       ContinueOnError="true" />
 <MSBuild Projects="WebProject1\WebProject1.csproj"
      Targets="ResolveReferences;_CopyWebApplication"
      Properties="WebProjectOutputDir=$(OutputDir)\WebProject1\; …
Run Code Online (Sandbox Code Playgroud)

.net msbuild teamcity .net-4.0 msbuild-task

23
推荐指数
2
解决办法
5万
查看次数

MSBuild - 如何从预先编写的命令行命令构建.NET解决方案文件(在XML任务脚本中)

我一直在研究MSBuild,因为我需要自动化我的开发商店的构建.我能够轻松编写一个.BAT文件,该文件调用VS命令提示符并将我的MSBuild命令传递给它.这很有效,而且有点漂亮.

这是我的.BAT构建文件的内容:

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
cd  C:\Sandbox\Solution
msbuild MyTopSecretApplication.sln /p:OutputPath=c:\TESTMSBUILDOUTPUT /p:Configuration=Release,Platform=x86
pause
Run Code Online (Sandbox Code Playgroud)

^这很好但我现在需要为TeamCity CI使用MSBuild任务.我曾尝试编写一些MSBuild脚本,但我不能让它们工作相同.我在.BAT文件中使用的命令的等效构建脚本是什么?有任何想法吗?

我尝试过这样的东西,但没有成功(我知道这是错的):

<?xml version="1.0"?>
<project name="Hello Build World" default="run" basedir=".">

<target name="build">
    <mkdir dir="mybin" />
    <echo>Made mybin directory!</echo>

  <csc target="exe" output="c:\TESTMSBUILDOUTPUT">
    <sources>
      <include name="MyTopSecretApplication.sln"/>
    </sources>
  </csc>
  <echo>MyTopSecretApplication.exe was built!</echo>
</target>

<target name="clean">
    <delete dir="mybin" failonerror="false"/>
</target>

<target name="run" depends="build">
  <exec program="mybin\MyTopSecretApplication.exe"/>
</target>
Run Code Online (Sandbox Code Playgroud)

我只需要一个MSBuild XML构建脚本,它将Release模式的单个解决方案编译到指定的输出目录.有帮助吗?

.net msbuild teamcity build .net-4.0

17
推荐指数
1
解决办法
3万
查看次数

通过MembershipProvider在断开连接的WPF应用程序中验证ActiveDirectory用户和GetRoles

我有一个项目要求,我需要在远程/断开连接的WPF应用程序中对ActiveDirectory进行身份验证.

可能有几种方法可以尝试这样做,但使用ActiveDirectory的MembershipProvider的最佳方法是什么?

我需要:

  1. 验证用户是否存在.
  2. 获取AD用户的组和角色.

这需要从Active Directory所在的网络外部的远程位置进行.

wpf roles active-directory membership-provider

9
推荐指数
1
解决办法
8236
查看次数

使用Powershell在IIS中设置网站的应用程序池

我需要一个Powershell命令,它相当于在IIS中添加一个网站,但是需要"应用程序池"的绑定:

在此输入图像描述

到目前为止,我可以添加一个这样做的网站:

New-Item iis:\Sites\swmarket -bindings @{protocol="http";bindingInformation="80:swmarket"} -physicalPath c:\inetpub\wwwroot
Run Code Online (Sandbox Code Playgroud)

但我不知道如何在新网站中设置"应用程序池".有什么方法可以看到所有的绑定吗?

iis powershell application-pool

7
推荐指数
1
解决办法
5688
查看次数

最强大的Powershell个人资料作弊?

我很好奇其他Powershell开发人员在其Powershell配置文件中发现有用的内容.可能性是无止境.

例如,我经常使用的最强大的Powershell配置文件函数是我的findTextInWorkspace函数.我工作的其他开发人员现在开始使用它,因为它被证明非常方便.该函数允许我搜索我的所有本地Powershell脚本以获取特定的文本模式,例如GREP.当脚本在我们的构建服务器上失败时,我可以插入关键字来追踪罪魁祸首.由于我们的应用程序域中有许多重复的脚本和嵌套的文件夹结构,因此该功能可以让我快速找到任何有问题或行为不当的脚本的完整路径.

# find explicit text in all Workspace powershell scripts
function findTextInWorkspace ([string] $text, [string] $path = "C:\Workspace\*")
{
    dir $path -recurse -filter '*.ps*1' | Get-ChildItem | select-string -pattern $text | Select-Object Path -Unique
}
Run Code Online (Sandbox Code Playgroud)

然后我可以调用它,就像这样:

cd C:\Workspace\MyApplication
findTextInWorkspace "thisvariablecausedmybuildtocrash" .
Run Code Online (Sandbox Code Playgroud)

我的问题是对于Powershell大师......你在Powershell简介中看到或使用过的最强大的"作弊"或强化是什么?我正在寻找创造性和有用的答案.

profile powershell settings

6
推荐指数
0
解决办法
464
查看次数

如何在System.Data.IDataReader中模拟GetValues()方法?

如何在System.Data.IDataReader中模拟GetValues()方法?

此方法更改传递给它的对象数组,因此它不能简单地返回模拟值.

private void UpdateItemPropertyValuesFromReader( object item, IDataReader reader )
{
    object[] fields = new object[ reader.FieldCount ];
    reader.GetValues( fields ); //this needs to be mocked to return a fixed set of fields


    // process fields
   ...
}
Run Code Online (Sandbox Code Playgroud)

c# unit-testing rhino-mocks datareader

5
推荐指数
1
解决办法
1246
查看次数

目录/文本搜索上的DISTINCT Select-String输出

我很好奇如何根据这个例子生成一个不同的文件列表.

**此示例生成包含文本"folders"但在同一行上没有文本".invoke"的所有.ps1和.psm1文件的列表.

$text='folders'
dir C:\Workspace\mydirectorytosearch1\ -recurse -filter '*.ps*1' | Get-ChildItem | select-string -pattern $text | where {$_ -NotLike '*.invoke(*'}
dir C:\Workspace\mydirectorytosearch2\ -recurse -filter '*.ps*1' | Get-ChildItem | select-string -pattern $text | where {$_ -NotLike '*.invoke(*'}
Run Code Online (Sandbox Code Playgroud)

这很酷,效果很好,但我得到重复的文件输出(相同的文件,但不同的行号).

如何保持文件输出清晰?

目前的不良输出:

  • C:\工作区\ mydirectorytosearch1 \匿名化-psake.ps1:4 :. "$($ folders.example.test)\ anonymize\Example.vars.ps1"C:\ Workspace\mydirectorytosearch1\anonymize-psake.ps1:5:."$($ folders.missles)\提取物\集结utilities.ps1"

所需的输出:

  • C:\工作区\ mydirectorytosearch1 \匿名-psake.ps1

帮我调整我的脚本?

powershell scripting powershell-ise powershell-2.0 powershell-3.0

5
推荐指数
1
解决办法
2935
查看次数

通过powershell将数据附加到现有的xml文件中

我可以帮助使用PowerShell将节点添加到现有XML中吗?

这是我有的:

<agentList>
 <newAgent>
      <name>Justice, Kari</name>
      <mu>4690</mu>
  <agentData>
   <group>
       <description>GROUP_DESCRIPTION</description><value>GROUP_NAME</value>
   </group>
  </agentData>
 </newAgent>
</agentList>
Run Code Online (Sandbox Code Playgroud)

我需要添加这个:

  <group><description>ACSR System Logon</description><value></value></group>
  <group><description>Current Call Type</description><value></value></group>
  <group><description>OMS</description><value></value></group>
  <group><description>RIO Log-in</description><value></value></group>
  <group><description>Site</description><value></value></group>
Run Code Online (Sandbox Code Playgroud)

这里:

<agentList>
 <newAgent>
      <name>Justice, Kari</name>
      <mu>4690</mu>
  <agentData>
   <group>
       <description>GROUP_DESCRIPTION</description><value>GROUP_NAME</value>
           <====== HERE
           <====== HERE
           <====== HERE
           <====== HERE
   </group>
  </agentData>
 </newAgent>
</agentList>
Run Code Online (Sandbox Code Playgroud)

我可能在XML上有多个用户,所以我想使用FOREACH行..但我在powershell中使用xml失去了...如果有人可以分享一些想法,我将很高兴与它一起玩...

xml powershell foreach selectnodes

2
推荐指数
1
解决办法
1万
查看次数

Flutter TabBar 和 TabBarView 的区别

TabBar我的问题是关于和之间的区别TabBarView。从外观上我看不出有什么区别,但是它们的功能是什么?

flutter

2
推荐指数
1
解决办法
2228
查看次数

PowerShell输出到文件

我想将PowerShell脚本的结果保存到文本文件中.我怎样才能做到这一点?

GET-CHILDITEM  -recurse C:\Enlistment\DAX\* | SELECT-STRING -pattern "BatchIL.start()"
Run Code Online (Sandbox Code Playgroud)

powershell batch-file powershell-2.0

1
推荐指数
1
解决办法
7987
查看次数