TFS Builds work on all all projects except the Node for Visual Studio Project.
I get this error:
$/IT/my-home.njsproj - 1 error(s), 0 warning(s), View Log File
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets (132): Could not copy the file "obj\Debug\my-home.exe" because it was not found.
I tried to do this below in the targets file:
<Disable_CopyWebApplication Condition="'$(Disable_CopyWebApplication)' == ''">True</Disable_CopyWebApplication>
I just came across this issue. Add this to your build arguments:
/p:Disable_CopyWebApplication=True
Related
I have an app that I'm trying to deploy to Azure using the Development Center. The app works great locally but when I check in my code and Azure starts the deployment process, it fails with the following message in reference to System.Xml.ReaderWriter.4.3.1:
error BC32210: Multiple assemblies with equivalent identity have been imported
The message is confusing because my packages.config only references the assembly once and the app builds fine locally.
How do I correct this problem?
Here's the full log entry:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
Restoring NuGet package System.Xml.ReaderWriter.4.3.1.
GET https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/4.3.1/system.xml.readerwriter.4.3.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/4.3.1/system.xml.readerwriter.4.3.1.nupkg 300ms
Installing System.Xml.ReaderWriter 4.3.1.
Adding package 'System.Xml.ReaderWriter.4.3.1' to folder 'D:\home\site\repository\packages'
Added package 'System.Xml.ReaderWriter.4.3.1' to folder 'D:\home\site\repository\packages'
NuGet Config files used:
C:\DWASFiles\Sites#1asdffdsa__fb6e\AppData\NuGet\NuGet.Config
Feeds used:
D:\home.nuget\
https://api.nuget.org/v3/index.json
Installed:
1 package(s) to packages.config projects
vbc : error BC32210: Multiple assemblies with equivalent identity have been imported: 'D:\home\site\repository\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll' and 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Xml.ReaderWriter.dll'. Remove one of the duplicate references. [D:\home\site\repository\DiocesanClaims\DiocesanClaims.vbproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\DiocesanClaims\DiocesanClaims.vbproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d70fa465288676";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\82.10503.3890\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
I'm not sure exactly what the issue was or why it was a problem but luckily, I didn't need the assembly in question. I uninstalled it from the list of Nuget packages and I was able to deploy fine after that.
We are currently trying to setup an Angular 2 project that also contains a Cloud Service project in its solution. We have set up numerous Angular 1 projects containing Cloud Service projects and have had no errors. When trying to run the MSBuild step for the Angular 2 project, we get the following error on the TeamCity build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.7\Microsoft.WindowsAzure.targets(2787, 5): error MSB3021: Unable to copy file "C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" to "C:\SourceControlFolder\Apps\MyApp\MyApp.CloudDeployment\obj\Debug\Website\C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs". The given path's format is not supported.
The main problem seems to be the build attempting to throw the full C:\TeamCityBuildAgent.. path into the obj\Debug\Website folder.
My current MSBuild parameters are:
/p:Configuration="Dev"
/p:platform="Any CPU"
/p:OctoPackEnforceAddingFiles=true
/p:OctoPackProjectName=MyApp_Dev
I've tried the following solutions:
Making sure the latest Visual Studio Update is installed (for MSBuild)
Running the install tool to repair Azure Tools 2.7 on the build server.
Changing the debug configuration in the build.
Ensuring TypeScript 1.7.6 is installed on the build server (even though it's an Azure.targets issue) [https://github.com/Microsoft/TypeScript/issues/6215]
Updated the project to Azure Tools 2.9. The same error remains except it's failing on the 2.9 folder instead now.
Curious if anyone else has experienced this error and knows a fix. I'll keep this post updated as I try other solutions.
Update
It appears that what is causing this issue is this line within the .csproj file:
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
This is specified for our build configurations to copy all files generated by the ng build to the output directory of the publish. What I don't understand at the moment is how this works on all of the devs' local machines but does not work on our build server. Will keep this posted as I find more info or any kind of workaround.
This ended up being the fix:
Instead of targeting the .sln in MSBuild, we specifically targeted the .csproj file. This fixed the build errors and allowed us to keep the FilesToIncludeForPublish tag inside.
I've written a small simple console app as a AspNet5 Console Package
namespace ConsoleApp1
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello world");
Console.ReadLine();
}
}
}
Running this through debug in Visual Studio and I get a command window with Hello World written in. However when I compile this with project properties "Produce outputs on build" I get an artifacts\bin\ConsoleApp1\Debug\app directory produced with the following output
and a dnx46 directory with
Contents of the .cmd file in the app directory is
#dnx --appbase "%~dp0." Microsoft.Dnx.ApplicationHost ConsoleApp1 %*
Contents of the project.json file is the following
{
"version": "1.0.0-*",
"description": "ConsoleApp1 Console Application",
"authors": [
"Doug"
],
"tags": [
""
],
"projectUrl": "",
"licenseUrl": "",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"ConsoleApp1": "1.0.0"
},
"commands": {
"ConsoleApp1": "ConsoleApp1"
},
"frameworks": {
"dnx46": {
"System.Console": "4.0.0-beta-23516"
}
},
"entryPoint": "ConsoleApp1",
"loadable": false
}
Double clicking the cmd file won't run the program. I put in the ReadLine() code to pause the app on run to see what the output would be, but I see it flash then go away. I've also tried running it from the app directory in powershell using the following command "dnx ConsoleApp1" but it won't run. This is just a simple console application and shouldn't be this hard to run but I can't seem to get it to run outside of the visual studio environment. What am I doing wrong????
Update 1
I got this to run executing from the directory of the src, but I can't seem to run the outputs in the same fashion from the artifacts directory. Any ideas???
PS C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1> dnx run
Hello world
Just as an FYI here is my dnvm list output
UPDATE 2
Below is the output if I change to the directory of the ".cmd" file and try executing it manually in an open window which is why it just terminates and closes... due to the contents of the .cmd file I figured this at the very least would work... I will try the dnu publish shortly. If the publish works then what is the point of the .cmd files produced in the artifacts directory.
UPDATE 3
Ok, so I ran the dnu publish command from the directory that contains the project source files. The output is below.
The resulting ".cmd" file highlighted in the directory structure was double clicked and the cmd.exe window appeared with the correct output. The directory structure and output are below.
However this made me curious... when I run the same dnu publish command in the artifacts directory produced by the compile and "Produce build outputs" option checked and the resulting .cmd file would not execute the console program??? What is the difference between the output in the artifacts directory and the files in program source that allow everything to be pulled together to execute.
PS... this seems like ALOT of work just to get a console program to run outside of visual studio! Is this the intent of DNX? No exe's? just curious
UPDATE 4
I ran the following in the directory for the output artifacts... the result was still no runable version of the program in the artifacts directory but the output files look almost identical to that of what was in the /src directory bin.
I apologize for not taking a screen shot but my screen wasn't big enough to hold everything at once.
PS C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app> dnu restore
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
CACHE https://www.nuget.org/api/v2/
Restoring packages for C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\project.json
Writing lock file C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\project.lock.json
Restore complete, 123ms elapsed
NuGet Config files used:
C:\Users\Doug\AppData\Roaming\NuGet\nuget.config
Feeds used:
https://www.nuget.org/api/v2/
PS C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app> dnu publish --runtime active --no-source
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
Copying to output path C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\bin\output
Using Project dependency app 1.0.0 for DNX,Version=v4.6
Packing nupkg from Project dependency app
Source C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\project.json
Target C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\bin\output\approot\packages\app\1.0.0
Building app for DNX,Version=v4.6
Using Project dependency app 1.0.0
Source: C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\project.json
Using Project dependency ConsoleApp1 1.0.0
Source: C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\project.json
Using Assembly dependency fx/mscorlib 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll
Using Assembly dependency fx/System 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.dll
Using Assembly dependency fx/System.Core 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll
Using Assembly dependency fx/Microsoft.CSharp 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\Microsoft.CSharp.dll
dnu : error CS5001: Program does not contain a static 'Main' method suitable for an entry point
At line:1 char:1
+ dnu publish --runtime active --no-source
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (error CS5001: P... an entry point:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Build failed.
0 Warning(s)
1 Error(s)
Time elapsed 00:00:00.3519605
Total build time elapsed: 00:00:00.3550713
Total projects built: 1
Using Project dependency ConsoleApp1 1.0.0 for DNX,Version=v4.6
Packing nupkg from Project dependency ConsoleApp1
Source C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\project.json
Target C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\bin\output\approot\packages\ConsoleApp1\1.0.0
Building ConsoleApp1 for DNX,Version=v4.6
Using Project dependency ConsoleApp1 1.0.0
Source: C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\project.json
Using Assembly dependency fx/mscorlib 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll
Using Assembly dependency fx/System 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.dll
Using Assembly dependency fx/System.Core 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll
Using Assembly dependency fx/Microsoft.CSharp 4.0.0
Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\Microsoft.CSharp.dll
Exported application command: ConsoleApp1
ConsoleApp1 -> C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\bin\Debug\ConsoleApp1.1.0.0.nupkg
ConsoleApp1 -> C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\bin\Debug\ConsoleApp1.1.0.0.symbols.nupkg
Build succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:00.2780556
Total build time elapsed: 00:00:00.2790409
Total projects built: 1
Adding NuGet package C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\bin\Debug\ConsoleApp1.1.0.0.nupkg to C:\Users\Doug\Documents\Visua
l Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app\bin\output\approot\packages
Installing ConsoleApp1.1.0.0
Add complete, 46ms elapsed
Removing C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\bin\Debug\ConsoleApp1.1.0.0.nupkg
Removing C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\ConsoleApp1\bin\Debug\ConsoleApp1.1.0.0.symbols.nupkg
Bundling runtime dnx-clr-win-x86.1.0.0-rc1-update1
Time elapsed 00:00:01.1140479
PS C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\artifacts\bin\ConsoleApp1\Debug\app>
Here was the directory output resulting in running the command dnu publish in the artifacts directory... the output was the same but the .cmd file wouldn't run
Can you tell me the difference between running against the /src directory of the project vs the /artifacts directory on produce outputs?
PS: sorry for such a long post, just really trying to wrap my head around this DNX stuff! And again thanks for your help
Since you listing multiple problems, I'm going to address them individually.
Double clicking the cmd file won't run the program. I put in the ReadLine() code to pause the app on run to see what the output would be, but I see it flash then go away.
That's expected. The cmd file launches the application in a new console and when the process terminates, the console closes.
You have a few options:
Just like you did, add a ReadLine at the end of the program.
Run the cmd file from a console.
Keep the console open after run by following the instructions in this question Batch files : How to leave the console window open
Update 1 I got this to run executing from the directory of the src, but I can't seem to run the outputs in the same fashion from the artifacts directory. Any ideas???
"Produce outputs on build" doesn't produce runnable executables (yes, it's confusing), but nuget packages.
So, in the dnx world:
If you produce outputs on build, that's the equivalent of running dnu pack.
If you want to create a folder that has a runnable app, you have to run dnu publish (or Publish from VS). Depending on what arguments you pass, you will get a folder that has the runnable app, its dependencies and, optionally, the runtime.
So, a self contained published app can be produced with:
dnu publish --runtime <runtime name or "active"> --no-source
The --no-source argument will precompile the projects for which you have sources (this is the closest you'll get to a classic C# app). Without that argument, the sources will be compile on the fly every time the app starts.
The default output of the publish command is under bin\output
I am using NodejsTools in Visual Studio 2013, but can publish my project to Azure. When I build my file I get the following error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Node.js
Tools\Microsoft.NodejsTools.targets(115,5): error MSB4018: The
"AssignTargetPath" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both
are too long. The fully qualified file name must be less than 260
characters, and the directory name must be less than 248 characters.
Any clues on how I can fix this/get my node project to publish up to Azure?
Update 1: If I move the project to a root folder in my Windows C: drive, the build error goes away and build succeeds. However, if I try to publish, it fails and does not give a reason why:
------ Publish started: Project: MyProject, Configuration: Release Any CPU ------ Auto ConnectionString Transformed Web.config into
obj\Release\CSAutoParameterize\transformed\Web.config. Copying all
files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I ran into the same problem. The paths created in the visual studio template are indeed too long to be uploaded on Azure. The paths are probably within your "node_modules" folder.
I solved this problem as follows:
Within the project folder, I deleted the folder "node_modules", containing all the modules needed to build your project. You can add these modules later, so no worries.
Open visual studio, reload the solution and publish your project again on your Azure account. Visual Studio probably doesn't return any errors now, since all paths are shorter than 240 characters.
Then, login on the Azure portal, open your web app and click on "add tiles" and add the console tile. Open the console tile and run the command "npm install". This command adds all dependencies within your project, hence adds the folder "node_modules" with all the modules needed for your project. You can see your project and work on them using the "Visual Studio Online Extension".
It’s difficult for troubleshooting if there is no error code.
I suggest you need check the <PropertyGroup> values such as <OutputPath>.</OutputPath> and so on in node.js project file which is end with .njsproj. Any information, please share it with me.
And in my test, I have to create a nodejs application via Azure Node.js application template so that I can publish it to Azure Web Apps.
You can try to create a new node.js app using Azure Node.js application and to check whether it can be published to Azure Web App. When succeed to publish app to Azure, you can copy your code into this project, then try to publish again.
Any concern, please let me know.
I have a WPF project that I normally publish for click once installs
The project stopped publishing about 3 days ago.
If I build and/or run the project from code it succeeds but publish fails.
Cannot publish because a project failed to build. 1 1 ProjectName
Could not find file 'obj\x86\Debug\ProjectName.exe'. ProjectName
Funny thing is if I look in the obj\x86\Debug folder it appears to put the ProjectName.exe in for a split second and then remove it again before failing.
The error in the output window is:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3075,5): error MSB3113: Could not find file 'obj\x86\Debug\ProjectName.exe'.
Error: Cannot publish because a project failed to build.
I've tried the normal stuff like cleaning, rebuilding, rebooting
After changing verbosity of build to diagnostics I got following information on the failure:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3075,5): error MSB3113: Could not find file 'obj\x86\Debug\ProjectName.exe'.
Done executing task "GenerateApplicationManifest" -- FAILED. (TaskId:147)
Done building target "GenerateApplicationManifest" in project "ProjectName.vbproj" -- FAILED.: (TargetId:166)
I was able to discover the answer by following paul's suggestion.
I increased the verbosity of the build project via Tools | Options | Projects And Solution | Build and Run | Project build output verbosity.
Once I looked at the more verbose build output fixing the problem was simple.
The verbose output gave me exactly where the publish was failing so I was then able to fix those problems.