.net

Using project references as assembly paths in T4

Deadly 提交于 2021-02-06 08:56:44
问题 I have a .tt script that needs to reference a couple of external assemblies. Is it possible for the T4 host to automatically include the assemblies referenced in the project - rather than me manually adding an assembly directive for each one? E.g. Referencing an assembly from a nuget is a moving target when using a path relative to $(ProjecDir) . Using assembly paths like $(Project)\bin\Debug\Example.dll also seems less than optimal - as it requires the build to have been successful

Using project references as assembly paths in T4

百般思念 提交于 2021-02-06 08:54:15
问题 I have a .tt script that needs to reference a couple of external assemblies. Is it possible for the T4 host to automatically include the assemblies referenced in the project - rather than me manually adding an assembly directive for each one? E.g. Referencing an assembly from a nuget is a moving target when using a path relative to $(ProjecDir) . Using assembly paths like $(Project)\bin\Debug\Example.dll also seems less than optimal - as it requires the build to have been successful

EPPlus with MemoryStream as email attachment — file is empty

拟墨画扇 提交于 2021-02-06 08:10:27
问题 I'm building a console app that moves data into an excel file (using EPPlus library). I'm saving the ExcelPackage as a MemoryStream, and I want to attach it to an email. However, when I receive the email, the Excel file is empty -- 0 bytes. Thoughts? MemoryStream outputStream = new MemoryStream(); using (ExcelPackage package = new ExcelPackage(outputStream)) { // export each facility's rollup and detail to tabs in Excel (two tabs per facility) ExcelWorksheet facilityWorksheet = package

EPPlus with MemoryStream as email attachment — file is empty

倾然丶 夕夏残阳落幕 提交于 2021-02-06 08:01:58
问题 I'm building a console app that moves data into an excel file (using EPPlus library). I'm saving the ExcelPackage as a MemoryStream, and I want to attach it to an email. However, when I receive the email, the Excel file is empty -- 0 bytes. Thoughts? MemoryStream outputStream = new MemoryStream(); using (ExcelPackage package = new ExcelPackage(outputStream)) { // export each facility's rollup and detail to tabs in Excel (two tabs per facility) ExcelWorksheet facilityWorksheet = package

EPPlus with MemoryStream as email attachment — file is empty

时光怂恿深爱的人放手 提交于 2021-02-06 08:00:23
问题 I'm building a console app that moves data into an excel file (using EPPlus library). I'm saving the ExcelPackage as a MemoryStream, and I want to attach it to an email. However, when I receive the email, the Excel file is empty -- 0 bytes. Thoughts? MemoryStream outputStream = new MemoryStream(); using (ExcelPackage package = new ExcelPackage(outputStream)) { // export each facility's rollup and detail to tabs in Excel (two tabs per facility) ExcelWorksheet facilityWorksheet = package

Where is == operator defined in Class “object”?

可紊 提交于 2021-02-06 06:31:49
问题 I searched the source code of FCL, and I got confused that string.Equals() uses Object.ReferenceEquals() , and Object.ReferenceEquals() uses == operator to jugde. And then I can't find how the == operator is defined. So where is the original operator defined? 回答1: This is an operator that the language uses to validate that two values are the same. When your code would be compiled this operator would be compiled appropriately in CIL and then when we will be executed by the CLR the two values

Loading .NET Assembly From Memory Instead of Disk [closed]

荒凉一梦 提交于 2021-02-06 05:35:17
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question I am having a perplexing problem trying to load a .NET assembly from memory instead of from the disk. If I compile the assembly and then load it from disk (either using LoadFile or LoadFrom), then the application works just fine. However, if I include the compiled

Loading .NET Assembly From Memory Instead of Disk [closed]

人盡茶涼 提交于 2021-02-06 05:34:33
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question I am having a perplexing problem trying to load a .NET assembly from memory instead of from the disk. If I compile the assembly and then load it from disk (either using LoadFile or LoadFrom), then the application works just fine. However, if I include the compiled

Optionally serialize a property based on its runtime value

◇◆丶佛笑我妖孽 提交于 2021-02-06 01:49:54
问题 Fundamentally, I want to include or omit a property from the generated Json based on its value at the time of serialization. More-specifically, I have a type that knows if a value has been assigned to it and I only want to serialize properties of that type if there has been something assigned to it (so I need to inspect the value at runtime). I'm trying to make it easy for my API to detect the difference between "has the default value" and "wasn't specified at all". A custom JsonConverter

Optionally serialize a property based on its runtime value

℡╲_俬逩灬. 提交于 2021-02-06 01:48:50
问题 Fundamentally, I want to include or omit a property from the generated Json based on its value at the time of serialization. More-specifically, I have a type that knows if a value has been assigned to it and I only want to serialize properties of that type if there has been something assigned to it (so I need to inspect the value at runtime). I'm trying to make it easy for my API to detect the difference between "has the default value" and "wasn't specified at all". A custom JsonConverter